Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

System Functions (n - p) pthread_join(2)
NAME
pthread_join - Causes the calling thread to wait for the termination of a thread
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
32-bit H-series and J-series OSS processes that use the POSIX User Thread Model library:
/G/system/zdllnnn/zputdll
64-bit H-series and J-series OSS processes that use the POSIX User Thread Model library:
/G/system/zdllnnn/yputdll
H-series and J-series OSS processes that use the Standard POSIX Threads library:
/G/system/zdllnnn/zsptdll
SYNOPSIS
#include <pthread.h> | #include <spthread.h>
/* pthread.h is required to use POSIX User Thread Model library */
/* spthread.h is required to use Standard POSIX Threads library */
int pthread_join(
pthread_t thread,
void **value_ptr);
PARAMETERS
thread Specifies the thread whose termination is awaited by the calling thread.
value_ptr Receives the return value of the terminating thread.
DESCRIPTION
This function suspends execution of the calling thread until the thread specified by the thread
parameter terminates.
On return from a successful pthread_join() call with a non-NULL value for value_ptr, the value
passed to the pthread_exit( ) function is returned in the location specified by value_ptr and the
terminating thread is detached.
A call to pthread_join( ) returns after the thread thread terminates.
The pthread_join() function is a deferred cancelation point: the thread thread is not detached if
the thread blocked in pthread_join() is canceled. If the thread that is being joined is canceled,
the pthread_join() function returns PTHREAD_CANCELED in the value_ptr parameter.
If the calling thread specifies itself as the thread value, [EDEADLK] is returned. A deadlock
does not occur.
The pthread_join() or pthread_detach( ) function should eventually be called for every thread
that is created with the detachstate attribute of its thread attributes object set to
PTHREAD_CREATE_JOINABLE, so that storage associated with the thread can be
reclaimed.
On systems running H06.21 or later H-series RVUs or J06.10 or later J-series RVUs, you can use
either the POSIX User Thread Model library or the Standard POSIX Threads library for threaded
applications.
To use this function in a threaded application that uses the POSIX User Thread Model library on
systems running H06.21 or later RVUs or J06.10 or later RVUs, you must perform all of the fol-
lowing tasks:
Include the pthread.h header file in the application.
527186-023 Hewlett-Packard Company 5125