Open System Services System Calls Reference Manual (G06.25+, H06.03+)
pthread_join(2) OSS System Calls Reference Manual
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
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
#include <spthread.h>
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.
NOTES
If more than one thread attempts to join with the same thread, the results are unpredictable.
RETURN VALUES
If an error condition occurs, this function returns an integer value indicating the type of error.
Possible return values are:
0 Successful completion.
[EDEADLK] A deadlock was detected, or the thread parameter specifies the calling thread.
[EINVAL] The thread parameter does not specify a joinable thread.
[ESRCH] The thread parameter does not specify an existing thread identifier.
RELATED INFORMATION
Functions: pthread_cancel(2), pthread_create(2), pthread_detach(2), pthread_exit(2).
5−68 Hewlett-Packard Company 527186-003