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 Library
HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


pthread_detach() — mark a thread as detached to reclaim its resources when it terminates


#include <pthread.h>

int pthread_detach( pthread_t thread );



Thread whose resources are to be reclaimed immediately when it terminates.


pthread_detach() is used to detach the thread thread. When thread terminates, its resources will automatically be reclaimed by the system. If thread has already terminated, pthread_detach() causes the resources of thread to be reclaimed by the system.

pthread_detach() does not cause thread to terminate.

Once a detached thread has terminated, its resources, including the thread ID, may be reused by the system. The return status of a detached thread is lost when the thread terminates.

Calling this function multiple times for the same thread results in undefined behavior.


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


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


thread does not refer to a joinable thread.


No thread could be found corresponding to thread.


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


pthread_detach(): 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.