This routine suspends execution of the calling thread until the
specified target thread thread terminates.
On return from a successful pthread_join() call with a non-
NULL value_ptr argument, the value passed to pthread_exit()
is returned in the location referenced by value_ptr, and the
terminating thread is detached.
If more than one thread attempts to join with the same thread,
the results are unpredictable.
A call to pthread_join() returns after the target thread
terminates. The pthread_join() routine is a deferred cancelation
point; the target thread will not be detached if the thread
blocked in pthread_join() is canceled.
If a thread calls this routine and specifies its own pthread_t, a
deadlock can result.
The pthread_join() (or pthread_detach()) routine should
eventually be called for every thread that is created with the
detachstate attribute of its thread object set to PTHREAD_CREATE_
JOINABLE, so that storage associated with the thread can be
reclaimed.
NOTE
For OpenVMS Alpha systems:
The pthread_join() routine is defined to pthread_join64()
if you compile using /pointer_size=long. If you do not
specify /pointer_size, or if you specify /pointer_
size=short, then pthread_join() is defined to be pthread_
join32(). You can call pthread_join32() or pthread_join64()
instead of pthread_join(). The pthread_join32() form
returns a 32-bit void * value in the address to which
value_ptr points. The pthread_join64() form returns a 64-
bit void * value. You can call either, or you can call
pthread_join(). Note that if you call pthread_join32() and
the thread with which you join returns a 64-bit value, the
high 32 bits of which are not 0 (zero), the Threads Library
discards those high bits with no warning.