[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]


pthread_detach

Marks a thread object for deletion.

Syntax

pthread_detach(
               thread );
 


Argument Data Type Access

thread opaque pthread_t read


C Binding

#include 

int pthread_detach ( pthread_t thread);

Arguments

thread
Thread object being marked for deletion.

Description

A call to this routine indicates that storage for the specified thread can be reclaimed when the thread terminates. This includes storage for the thread argument's return value, as well as the thread object. If thread has not terminated when this routine is called, this routine does not cause it to terminate.

When a thread object is no longer referenced, call this routine.

The results of this routine are unpredictable if the value of thread refers to a thread object that does not exist.

A thread can be created "pre-detached" using its thread object's detach state attribute. The pthread_join function also detaches the target thread when pthread_join returns successfully.

Return Values

If an error condition occurs, this routine returns an integer indicating the type of error. Possible return values are as follows:
Return        Description

0 Successful completion. [EINVAL] The value specified by thread does not refer to a joinable thread. [ESRCH] The value specified by thread cannot be found.


Associated Routines

   pthread_cancel
   pthread_create
   pthread_exit
   pthread_join



[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]