|PTHREAD_JOIN(3)||Linux Programmer's Manual||PTHREAD_JOIN(3)|
NAMEpthread_join - join with a terminated thread
int pthread_join(pthread_t thread, void **retval);
Compile and link with -pthread.
DESCRIPTIONThe pthread_join() function waits for the thread specified by thread to terminate. If that thread has already terminated, then pthread_join() returns immediately. The thread specified by thread must be joinable.
RETURN VALUEOn success, pthread_join() returns 0; on error, it returns an error number.
- A deadlock was detected (e.g., two threads tried to join with each other); or thread specifies the calling thread.
- thread is not a joinable thread.
- Another thread is already waiting to join with this thread.
- No thread with the ID thread could be found.
NOTESAfter a successful call to pthread_join(), the caller is guaranteed that the target thread has terminated.
SEE ALSOpthread_cancel(3), pthread_create(3), pthread_detach(3), pthread_exit(3), pthread_tryjoin_np(3), pthreads(7)
COLOPHONThis page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/.