76 lines
1.5 KiB
Plaintext
76 lines
1.5 KiB
Plaintext
'\"macro stdmacro
|
|
.\"
|
|
.\" ----------------
|
|
.TH pthread_join 3P
|
|
.\"
|
|
.\" ----------------
|
|
.SH NAME
|
|
pthread_join \- wait for thread termination
|
|
.\"
|
|
.\" ----------------
|
|
.Op c p a
|
|
.SH C SYNOPSIS
|
|
.nf
|
|
.ft 3
|
|
#include <pthread.h>
|
|
.sp .8v
|
|
int pthread_join(pthread_t thread, void \(**\(**retval);
|
|
.ft 1
|
|
.fi
|
|
.Op
|
|
.\"
|
|
.\" ----------------
|
|
.SH DESCRIPTION
|
|
The
|
|
.IR pthread_join ()
|
|
function waits for the thread identified by
|
|
.I thread
|
|
to terminate.
|
|
If
|
|
.I retval
|
|
is not zero, then it will be set to the exit value of the thread [see
|
|
.IR pthread_exit (),
|
|
.IR pthread_cancel ()].
|
|
Only one thread may wait for another at one time.
|
|
.\"
|
|
.PP
|
|
A detached thread [see
|
|
.IR pthread_detach ()]
|
|
may not be joined.
|
|
A successful join will automatically detach the target thread.
|
|
However,
|
|
.IR pthread_join ()
|
|
is a cancellation point and if the joiner is cancelled, the target
|
|
thread remains undetached and can be the target of another
|
|
.IR pthread_join ().
|
|
If a thread becomes detached after another thread is waiting for it,
|
|
the waiting thread is awoken and returns an error.
|
|
.\"
|
|
.\" ----------------
|
|
.SH DIAGNOSTICS
|
|
On success
|
|
.IR pthread_join ()
|
|
returns zero; otherwise an error number is returned:
|
|
.\"
|
|
.TP 15
|
|
.B [ESRCH]
|
|
The
|
|
.I thread
|
|
parameter does not identify a thread.
|
|
.\"
|
|
.TP
|
|
.B [EINVAL]
|
|
The thread identified by
|
|
.I thread
|
|
is not joinable (it is detached).
|
|
.\"
|
|
.TP
|
|
.B [EDEADLK]
|
|
The thread identified by
|
|
.I thread
|
|
is the calling thread.
|
|
.\"
|
|
.\" ----------------
|
|
.SH "SEE ALSO"
|
|
pthread_exit(3P), pthread_cancel(3P), pthread_detach(3P).
|