pthread_exit - terminate the calling thread
void pthread_exit(void *retval);
The pthread_exit() function terminates the calling thread. If the thread
is not detached, then the value retval may be retrieved by
pthread_join(). If a thread returns from its start function [see
pthread_create()] it acts as if it had called pthread_exit() with retval
as the value returned. A thread implicitly exits when it acts on a
cancellation request [see pthread_cancel()].
When a thread exits it pops and executes any cancellation handlers which
are still active [see pthread_cleanup_push()]. Following the handlers,
per-thread data is destroyed by invoking the destructor function for any
non-zero thread specific values associated with active keys [see
When the last thread terminates the process exits with a zero status
No value is returned by pthread_exit().
pthread_create(3P), pthread_join(3P), pthread_cancel(3P),
PPPPaaaaggggeeee 1111 [ Back ]