1 .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
2 .\" <mtk.manpages@gmail.com>
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
24 .TH PTHREAD_TRYJOIN_NP 3 2008-11-11 "Linux" "Linux Programmer's Manual"
26 pthread_tryjoin_np, pthread_timedjoin_np \- try to join with a
30 .B #define _GNU_SOURCE
31 .B #include <pthread.h>
33 .BI "int pthread_tryjoin_np(pthread_t " thread ", void **" retval );
35 .BI "int pthread_timedjoin_np(pthread_t " thread ", void **" retval ,
36 .BI " const struct timespec *" abstime );
39 Compile and link with \fI\-pthread\fP.
41 These functions operate in the same way as
43 except for the differences described on this page.
46 .BR pthread_tryjoin_np ()
47 function performs a nonblocking join with the thread
49 returning the exit status of the thread in
53 has not yet terminated, then instead of blocking, as is done by
55 the call returns an error.
58 .BR pthread_timedjoin_np ()
59 function performs a join-with-timeout.
62 has not yet terminated,
63 then the call blocks until a maximum time, specified in
65 If the timeout expires before
68 the call returns an error.
71 argument is a structure of the following form,
72 specifying an absolute time measured since the Epoch (see
78 time_t tv_sec; /* seconds */
79 long tv_nsec; /* nanoseconds */
85 these functions return 0;
86 on error, they return an error number.
88 These functions can fail with the same errors as
90 .BR pthread_tryjoin_np ()
91 can in addition fail with the following error:
95 had not yet terminated at the time of the call.
97 .BR pthread_timedjoin_np ()
98 can in addition fail with the following error:
101 The call timed out before
105 .BR pthread_timedjoin_np ()
106 never returns the error
109 These functions first appeared in glibc in version 2.3.3.
111 These functions are nonstandard GNU extensions;
112 hence the suffix "_np" (nonportable) in the names.
114 The following code waits to join for up to 5 seconds:
122 if (clock_gettime(CLOCK_REALTIME, &ts) == \-1) {
128 s = pthread_timedjoin_np(thread, NULL, &ts);
134 .BR clock_gettime (2),
135 .BR pthread_join (3),
136 .BR pthread_exit (3),