1 .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
2 .\" <mtk.manpages@gmail.com>
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
26 .TH PTHREAD_TRYJOIN_NP 3 2017-09-15 "Linux" "Linux Programmer's Manual"
28 pthread_tryjoin_np, pthread_timedjoin_np \- try to join with a
32 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
33 .B #include <pthread.h>
35 .BI "int pthread_tryjoin_np(pthread_t " thread ", void **" retval );
37 .BI "int pthread_timedjoin_np(pthread_t " thread ", void **" retval ,
38 .BI " const struct timespec *" abstime );
41 Compile and link with \fI\-pthread\fP.
43 These functions operate in the same way as
45 except for the differences described on this page.
48 .BR pthread_tryjoin_np ()
49 function performs a nonblocking join with the thread
51 returning the exit status of the thread in
55 has not yet terminated, then instead of blocking, as is done by
57 the call returns an error.
60 .BR pthread_timedjoin_np ()
61 function performs a join-with-timeout.
64 has not yet terminated,
65 then the call blocks until a maximum time, specified in
67 If the timeout expires before
70 the call returns an error.
73 argument is a structure of the following form,
74 specifying an absolute time measured since the Epoch (see
80 time_t tv_sec; /* seconds */
81 long tv_nsec; /* nanoseconds */
87 these functions return 0;
88 on error, they return an error number.
90 These functions can fail with the same errors as
92 .BR pthread_tryjoin_np ()
93 can in addition fail with the following error:
97 had not yet terminated at the time of the call.
99 .BR pthread_timedjoin_np ()
100 can in addition fail with the following errors:
103 The call timed out before
113 is greater than 1e9).
115 .BR pthread_timedjoin_np ()
116 never returns the error
119 These functions first appeared in glibc in version 2.3.3.
121 For an explanation of the terms used in this section, see
128 Interface Attribute Value
130 .BR pthread_tryjoin_np (),
131 .BR pthread_timedjoin_np ()
132 T} Thread safety MT-Safe
136 These functions are nonstandard GNU extensions;
137 hence the suffix "_np" (nonportable) in the names.
139 The following code waits to join for up to 5 seconds:
148 if (clock_gettime(CLOCK_REALTIME, &ts) == \-1) {
154 s = pthread_timedjoin_np(thread, NULL, &ts);
161 .BR clock_gettime (2),
162 .BR pthread_exit (3),
163 .BR pthread_join (3),