Open System Services System Calls Reference Manual (G06.25+, H06.03+)

System Functions (n - p) pthread_exit(2)
NAME
pthread_exit - Terminates the calling thread
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
#include <spthread.h>
void pthread_exit(
void *value_ptr );
PARAMETERS
value_ptr species the value to be copied and returned to the caller of the pthread_join( )
function. Note that void * is used as a universal datatype, not as a pointer. The
system treats the value_ptr parameter as a value and stores it to be returned by
pthread_join().
DESCRIPTION
This function terminates the calling thread and makes a status value (value_ptr) available to any
thread that calls pthread_join( ) to join the terminating thread.
Any cleanup handlers that have been pushed and not yet popped from the stack are popped in the
reverse order that they were pushed and then executed. After all cleanup handlers have been
executed, if the thread has any thread-specic data, appropriate destructor functions are called.
Thread termination does not release any application-visible process resources, including, but not
limited to, mutexes and le descriptors, nor does it perform any process-level cleanup actions,
including, but not limited to, calling any atexit routine that might exist.
An implicit call to pthread_exit() is issued when a thread returns from the start routine that was
used to create it. The system writes the functions return value as the return value in the threads
thread object. The process exits with an exit status of 0 (zero) when the last running thread calls
pthread_exit().
NOTES
After a thread has terminated, the result of access to local (that is, explicitly or implicitly
declared auto) variables of the thread is undened. References to local variables of the existing
thread should not be used for the value_ptr parameter of the pthread_exit( ) function.
RELATED INFORMATION
Functions: pthread_cancel(2), pthread_create(2), pthread_detach(2), pthread_join(2).
STANDARDS CONFORMANCE
This function is an extension to the XPG4 Version 2 specication. 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 le spthread.h is an HP exception to the POSIX standard.
527186-003 Hewlett-Packard Company 561