DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

pthread_detach(3pthread)


pthread_detach -- detach a thread

Synopsis

cc [options] -Kthread file

#include <pthread.h>

int pthread_detach(pthread_t thread);

Description

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

References

pthread_join(3pthread), pthread(4)

Standards compliance

The Single UNIX Specification, Version 2; The Open Group.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004