Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > P

pthread_join(3T)

Pthread Library
HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

pthread_join() — wait for the termination of a specified thread

SYNOPSIS

#include <pthread.h>

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

PARAMETERS

thread

Thread whose termination is awaited by the caller.

value_ptr

Pointer to the location where the exit status of thread is returned.

DESCRIPTION

The pthread_join() function waits for the termination of the target thread. If the target thread has already terminated, this function returns immediately. Only threads created with a detachstate attribute value of PTHREAD_CREATE_JOINABLE may be specified in the target thread parameter. On successful return from pthread_join(), the value_ptr argument, if it is not a null pointer, will contain the value passed to pthread_exit() by the terminating thread.

When a pthread_join() call returns successfully, the caller is guaranteed the target thread has terminated. If more than one thread calls pthread_join() for the same target thread, one thread is guaranteed to return successfully. Undefined behavior results for other callers specifying the same thread.

If the thread calling pthread_join() is canceled, the target thread shall not be joined. The exit status of the target thread will remain available for another thread to call pthread_join().

If the target thread was canceled, its exit status is PTHREAD_CANCELED.

It is unspecified whether a thread that has exited, but remains unjoined, counts against the {_POSIX_THREAD_THREADS_MAX} limit.

RETURN VALUE

Upon successful completion, pthread_join() returns zero. Otherwise, an error number is returned to indicate the error (the errno variable is not set).

ERRORS

If any of the following occur, the pthread_join() function returns the corresponding error number:

[EINVAL]

The value specified by thread does not refer to a joinable thread.

[ESRCH]

No thread could be found corresponding to thread.

For each of the following conditions, if the condition is detected, the pthread_join() function returns the corresponding error number:

[EDEADLK]

This operation would result in process deadlock or thread specifies the calling thread.

AUTHOR

pthread_join() was derived from the IEEE POSIX P1003.1c standard.

STANDARDS CONFORMANCE

pthread_join(): POSIX 1003.1c.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.