Name:
|
System call or function: Function | Links: Online Manual | Course Packet |
What it does: detaches a thread : the thread is no longer joinable, so there is no need to join it. A detached thread automatically releases its resources upon exit from the thread's function. |
||
What libraries you must include:
|
||
Syntax:
|
||
Description of arguments: : pointer to a variable that was used for calling .
|
||
What type it returns:
|
On success:
|
|
On failure: a non-zero error number that is usually set to. |
||
If failure, does it set ? No |
||
Quick example:
|
||
Other variations: N/A |
Rule of thumb: your program must call either
pthread_join()
or pthread_detach()
(but not both) on every thread that you create with pthread_create()
!
Otherwise, if a thread isn't joined nor detached, it will release it resources only after the process exits.