Open System Services System Calls Reference Manual (G06.25+, H06.03+)
System Functions (n - p) pthread_detach(2)
NAME
pthread_detach - Marks a thread object for deletion
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/ZDLLnnn/zsptdll
SYNOPSIS
#include <spthread.h>
int pthread_detach(
pthread_t thread );
PARAMETERS
thread specifies the thread object being marked for deletion.
DESCRIPTION
This function marks the specified thread object to indicate that storage for the corresponding
thread can be reclaimed when the thread terminates. This storage includes storage for the thread
parameter’s return value, as well as for the thread object. If the specified thread has not ter-
minated when this function is called, this function does not cause it to terminate.
A thread can be created already marked for deletion by setting its thread object’s detachstate
attribute using the pthread_attr_setdetachstate() function before creating the thread.
Once detached, the use of the thread’s thread identifier in a call to the pthread_join() function
results in an error. A joinable thread is implicitly detached when pthread_join( ) is called.
RETURN VALUES
If an error condition occurs, this function returns an integer value indicating the type of error.
Possible return values are:
0 Successful completion.
[EINVAL] The thread parameter does not specify a joinable thread.
[ESRCH] The object specified by the thread parameter cannot be found.
RELATED INFORMATION
Functions: pthread_attr_getdetachstate(2), pthread_attr_setdetachstate(2),
pthread_cancel(2), pthread_create(2), pthread_exit(2), pthread_join(2).
STANDARDS CONFORMANCE
This function is an extension to the XPG4 Version 2 specification. Interfaces documented on this
reference page conform to the following industry standards:
• IEEE Std 1003.1c-1995, POSIX System Application Program Interface
The use of the header file spthread.h is an HP exception to the POSIX standard.
527186-003 Hewlett-Packard Company 5−59