pthread_join(3P) pthread_join(3P)
pthread_join - wait for thread termination
#include <pthread.h>
int pthread_join(pthread_t thread, void **retval);
The pthread_join() function waits for the thread identified by thread to
terminate. If retval is not zero, then it will be set to the exit value
of the thread [see pthread_exit(), pthread_cancel()]. Only one thread
may wait for another at one time.
A detached thread [see pthread_detach()] may not be joined. A successful
join will automatically detach the target thread. However,
pthread_join() is a cancellation point and if the joiner is cancelled,
the target thread remains undetached and can be the target of another
pthread_join(). If a thread becomes detached after another thread is
waiting for it, the waiting thread is awoken and returns an error.
On success pthread_join() returns zero; otherwise an error number is
returned:
[ESRCH] The thread parameter does not identify a thread.
[EINVAL] The thread identified by thread is not joinable (it is
detached).
[EDEADLK] The thread identified by thread is the calling thread.
pthread_exit(3P), pthread_cancel(3P), pthread_detach(3P).
PPPPaaaaggggeeee 1111 [ Back ]
|