Open System Services System Calls Reference Manual (G06.25+, H06.03+)
System Functions (n - p) pthread_create(2)
• To exit a thread terminated by a call to pthread_exit(), the system raises the
pthread_exit_e exception. To exit a thread terminated by cancelation, the system raises
the pthread_cancel_e exception. Your program can use the exception package to
operate on the generated exception.
• For each of the terminated thread’s thread-specific data keys that has a non-NULL value
and a non-NULL destructor pointer, the system sets the thread’s value for the
corresponding key to NULL.
In turn, the system calls each thread-specific data destructor function in this mul-
tithreaded process’s list of destructors. The destructor is given the value previously asso-
ciated with the data key as its sole argument. The destructor must delete all storage asso-
ciated with the data key; otherwise, the destructor will be called again.
The system repeats this step either until all thread-specific data values in the thread are
NULL or for up to a number of iterations equal to
PTHREAD_DESTRUCTOR_ITERATIONS
. This action should destroy all thread-
specific data associated with the terminated thread.
• The system unblocks the thread (if there is one) that is currently waiting to join with the
terminated thread. That is, the system unblocks the thread that is waiting in a call to
pthread_join().
• If the thread is already detached, the system destroys its thread object. Otherwise, the
thread continues to exist until it is detached or joined with.
NOTES
The practice of using CATCH handlers in place of pthread_cleanup_push() is not portable.
RETURN VALUES
If an error condition occurs, no thread is created, the contents of thread are undefined, and this
function returns an integer value indicating the type of error. Possible return values are:
0 Successful completion.
[EAGAIN] The system lacks the necessary resources to create another thread, or the
system-imposed limit on the total number of threads under execution by a single
user is exceeded.
[EINVAL] The value specified by the attr parameter is invalid.
RELATED INFORMATION
Functions: pthread_atfork(2), pthread_attr_destroy(2), pthread_attr_init(2),
pthread_attr_setdetachstate(2), pthread_attr_setinheritsched(2),
pthread_attr_setschedparam(2), pthread_attr_setschedpolicy(2),
pthread_attr_setstacksize(2), pthread_cancel(2), pthread_cleanup_pop(2),
pthread_cleanup_push(2), pthread_detach(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−57