Visit Our UNIX and Linux User Community

Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pthread_join(3) [osf1 man page]

pthread_join(3) 					     Library Functions Manual						   pthread_join(3)

NAME
pthread_join - Causes the calling thread to wait for the termination of the specified thread. LIBRARY
DECthreads POSIX 1003.1c Library (libpthread.so) SYNOPSIS
#include <pthread.h> int pthread_join( pthread_t thread, void **value_ptr); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: IEEE Std 1003.1c-1995, POSIX System Application Program Interface PARAMETERS
Thread whose termination is awaited by the calling routine. Return value of the terminating thread (when that thread either calls pthread_exit(3) or returns from its start routine). DESCRIPTION
This routine suspends execution of the calling thread until the specified target thread thread terminates. On return from a successful pthread_join(3) call with a non-NULL value_ptr argument, the value passed to pthread_exit(3) 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(3) returns after the target thread terminates. The pthread_join(3) routine is a deferred cancelation point: the target thread will not be detached if the thread blocked in pthread_join(3) is canceled. If a thread calls this routine and specifies its own pthread_t, a deadlock can result. The pthread_join(3) (or pthread_detach(3)) routine 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. RETURN VALUES
If an error condition occurs, this routine returns an integer value indicating the type of error. Possible return values are as follows: Successful completion. The value specified by thread does not refer to a joinable thread. The value specified by thread does not refer to an existing thread ID. A deadlock was detected, or thread specifies the calling thread. ERRORS
None RELATED INFORMATION
Functions: pthread_cancel(3), pthread_create(3), pthread_detach(3), pthread_exit(3) Manuals: Guide to DECthreads and Programmer's Guide delim off pthread_join(3)

Check Out this Related Man Page

pthread_exit(3) 					     Library Functions Manual						   pthread_exit(3)

NAME
pthread_exit - Terminates the calling thread. LIBRARY
DECthreads POSIX 1003.1c Library (libpthread.so) SYNOPSIS
#include <pthread.h> void pthread_exit( void *value_ptr); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: IEEE Std 1003.1c-1995, POSIX System Application Program Interface PARAMETERS
Value copied and returned to the caller of pthread_join(3). Note that void * is used as a universal datatype, not as a pointer. DEC- threads treats the value_ptr as a value and stores it to be returned by pthread_join(3). DESCRIPTION
This routine terminates the calling thread and makes a status value (value_ptr) available to any thread that calls pthread_join(3) and specifies the terminating thread. Any cleanup handlers that have been pushed and not yet popped from the stack, are popped in the reverse order that they were pushed and then executed. After all cleanup handlers have been executed, appropriate destructor functions shall be called in an unspecified order if the thread has any thread-specific data. Thread termination does not release any application-visible process resources, including, but not limited to mutexes and file descriptors, nor does it perform any process-level cleanup actions, including, but not limited to calling any atexit routine that may exist. An implicit call to pthread_exit(3) is issued when a thread returns from the start routine that was used to create it. DECthreads writes the function's return value as the return value in the thread's thread object. The process exits when the last running thread calls pthread_exit(3). After a thread has terminated, the result of access to local (that is, explicitly or implicitly declared auto) variables of the thread is undefined. So, references to local variables of the existing thread should not be used for the value_ptr argument of the pthread_exit(3) routine. RETURN VALUES
None ERRORS
None RELATED INFORMATION
Functions: pthread_cancel(3), pthread_create(3), pthread_detach(3), pthread_join(3) Manuals: Guide to DECthreads and Programmer's Guide delim off pthread_exit(3)

Featured Tech Videos