Index of Section 2 Manual Pages
| Interix / SUA | pthread_exit.2 | Interix / SUA |
pthread_exit(2) pthread_exit(2)
pthread_exit()
NAME
pthread_exit() - terminate a thread
SYNOPSIS
#include
void pthread_exit(void *value_ptr);
DESCRIPTION
The pthread_exit(2) function terminates the calling thread, making the
value referenced by the value_ptr argument available to any thread that
was previously joined to the calling thread. If any cancellation cleanup
handlers have been pushed onto the cleanup handler stack without having
been popped, they are popped and executed in the reverse order in which
they were pushed onto the stack. Calling this function to terminate a
thread does not release process resources visible to the application, such
as mutexes and file descriptors, nor does it result in any process-level
cleanup operations.
The pthread_exit() function is called implicitly whenever a thread returns
from the start routine that created it, except for the thread in which
main() was first called. The function's return value is the thread's exit
status.
After the last thread has been terminated, the process exits with the exit
status zero, as though exit(3) had been called with zero as the argument
when the last thread was terminated.
RETURN VALUES
This function does not return to the caller.
ERRORS
None.
NOTES
Access to local variables of the thread after the thread is terminated
cannot be guaranteed. For this reason, you should not use local variables
as the value_ptr argument.
SEE ALSO
exit(3)
pthread_create(2)
pthread_join(2)
USAGE NOTES
The pthread_exit function is thread safe.
The pthread_exit function is not async-signal safe.