(see pthread_create())
pthread_join
Prototype:
#include <pthread.h>
int pthread_join(pthread_t tchild, void **retval);
General Description: Similar to the wait() system call, this call waits for and accepts the return value of the child thread.
Return Value: A positive value if successful. If the thread-create call encountered any errors, the call returns a negative value and sets errno to the error.
Parameters
thread The thread handle to wait on.
retval The pointer to the value passed back (passed by reference).
Possible Errors
ESRCH
No thread could be found corresponding to that specified by tchild.
EINVAL The tchild thread has been detached.
EINVAL Another thread is already waiting on termination of tchild.
EDEADLK The tchild argument refers to the calling thread.
Examples