pthread_join()

wait for thread termination 

Function


SYNOPSIS

#include <pthread.h>

int pthread_join(pthread_t thread, void **status);


DESCRIPTION

The pthread_join() function suspends execution of the calling thread until the target thread terminates, unless the target thread has already terminated. If status is non-NULL, the value passed to pthread_exit() by the terminated thread is stored in the location pointed to by status. When a pthread_join() function returns successfully, the target thread has been terminated. The result of multiple simultaneous calls to pthread_join() for the same target thread is undefined. If the thread calling pthread_join() is canceled, the target thread is not detached.


PARAMETERS

thread 

Is the thread to wait for.

status 

Is the location where the exit status of the joined thread is stored. This can be set to NULL if the exit status is not required.


RETURN VALUES

On success, pthread_join() returns 0. On error, one of the following values is returned:

EDEADLK 

A deadlock was detected or thread is the calling thread.

EINVAL 

thread does not refer to a joinable thread.

ESRCH 

thread does not specify a currently running thread in the process.

EFAULT 

status is an invalid pointer.


CONFORMANCE

POSIX P1003.1 (1996)


MULTITHREAD SAFETY LEVEL

MT-safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
pthread_create(), pthread_detach(), pthread_exit()


PTC MKS Toolkit 10.4 Documentation Build 39.