[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    pthread_detach(3T) manual page Table of Contents

Name

pthread_detach - dynamically detaching a thread

Synopsis

Posix

cc [ flag ... ] file ... -lpthread [ library ... ]

#include <pthread.h>
int pthread_detach(pthread_t threadID);

MT-Level

MT-Safe

Description

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());

Return Values

Upon successful completion, 0 is returned; otherwise, a non-zero value indicates an error.

Errors

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.

See Also

pthread_create(3T) , pthread_join(3T)


Table of Contents