pthread_detach
is used to indicate to the implementation that storage
for the thread
thread
can be reclaimed when that thread terminates.
After pthread_detach is called for thread,
it is no longer possible to successfully pthread_join
with thread.
If
thread
has not terminated,
pthread_detach
will not cause it to terminate.
The effect of multiple
pthread_detach
calls on the same target thread is unspecified.
Return values
If the call succeeds,
pthread_detach
returns 0.
Otherwise, an error number is returned to indicate the error.
Diagnostics
pthread_detach
function will fail if:
EINVAL
the value specified by
thread
does not refer to a joinable thread
ESRCH
no thread could be found corresponding to that specified
by the given thread ID