Causes the calling thread to wait for the termination of a specified thread.
pthread_join( thread, status );
Argument Data Type Accessthread opaque pthread_t read status opaque pthread_addr_t write
int pthread_join ( pthread_t thread, pthread_addr_t *status);
If the thread exits normally, the status value argument is the address that the specified thread generates as its result. The thread's result is normally returned as the value of the start_ routine argument in its call to pthread_create. If the thread does not exit normally, the value of status is -1.
Any number of threads can call this routine. All calling threads are awakened when the specified thread terminates.
If the current thread calls this routine, a deadlock can result (if it is not detected by the implementation).
The results of this routine are unpredictable if the value for thread refers to a thread object that no longer exists (that is, one that has been detached).
Return Error Description0 Successful completion. -1 [EINVAL] The value specified by thread is invalid. -1 [ESRCH] The value specified by thread does not refer to an existing thread.