PTHREAD_DETACH(3P) BSD PTHREAD_DETACH(3P)
NAME
pthread_detach - Detaches a thread
SYNOPSIS
#include <pthread.h>
int pthread_detach (thread)
pthread_t *thread;
DESCRIPTION
The pthread_detach function indicates that all resources for thread may
be reclaimed when thread terminates. This may include storage for
thread's return value. If thread has not terminated, pthread_detach will
not cause it to terminate, but will cause the storage to be reclaimed
after thread terminates.
The thread argument Specifies the address of the ID of the thread to
detach.
Once a thread has been detached, any subsequent calls to the
pthread_join() function will fail.
NOTES
This interface is based on draft 4 of the IEEE P1003.4a standard, and
will be changed to conform to the final version.
DIAGNOSTICS
Upon successful completion, the thread argument is set to an illegal
value, and a value of 0 (zero) is returned. Otherwise, -1 is returned and
errno is set to indicate the error.
ERRORS
If the pthread_detach function fails, errno may be set to one of the
following values:
[EINVAL] The value specified by the thread argument is invalid.
[ESRCH] The value specified by the thread argument does not refer to an
existing thread.
SEE ALSO
pthread_join(3P)