pthread_detach(3T) manual page
Table of Contents
pthread_detach - dynamically detaching a thread
cc
[ flag ... ] file ... -lpthread [ library ... ]
#include <pthread.h>
int pthread_detach(pthread_t threadID);
MT-Safe
pthread_detach()
can dynamically reset the detachstate attribute of a thread to PTHREAD_CREATE_DETACHED.
For example, a thread could detach itself as follows:
pthread_detach(pthread_self());
Upon successful completion, 0 is returned; otherwise, a non-zero
value indicates an error.
These functions fail and return the corresponding
value, if any of the following conditions are detected:
- EINVAL
- The value
specified by threadID is not a joinable thread.
- ESRCH
- The value specified
by threadID is not an existing thread ID.
pthread_create(3T)
, pthread_join(3T)
Table of Contents