Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
System Functions (n - p) pthread_create(2)
normally and the start routine does not provide a return value, the results obtained by
joining with that thread are unpredictable.
• If the termination results from a cancelation request or a call to pthread_exit( ), the sys-
tem calls, in turn, each cleanup handler that this thread declared using the
pthread_cleanup_push( ) macro that has not yet been removed using the
pthread_cleanup_pop( ) macro. (The system also transfers control to any appropriate
CATCH, CATCH_ALL,orFINALLY blocks.)
For C++: At normal exit from a thread, a program calls the appropriate destructor func-
tions, just as if an exception had been raised.
• 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.
On systems running H06.21 or later H-series RVUs or J06.10 or later J-series RVUs, you can use
either the POSIX User Thread Model library or the Standard POSIX Threads library for threaded
applications.
To use this function in a threaded application that uses the POSIX User Thread Model library on
systems running H06.21 or later RVUs or J06.10 or later RVUs, you must perform all of the fol-
lowing tasks:
• Include the pthread.h header file in the application.
• Compile the application using the _PUT_MODEL_ feature test macro or equivalent
compiler command option.
• Link the application to the zputdll library (/G/system/zdllnnn/zputdll).
On systems running H06.24 or later H-series RVUs or J06.13 or later J-series RVUs, you can use
the POSIX User Thread Model library with 32-bit or 64-bit threaded applications.
To use this function in a 32-bit threaded application that uses the POSIX User Thread Model
library on systems running H06.24 or later RVUs or J06.13 or later RVUs, perform the same
tasks (described above) used to enable the POSIX User Thread Model library on systems running
H06.21/J06.10 or later RVUs.
527186-023 Hewlett-Packard Company 5−103