diff options
| author | Alejandro Colomar <alx.manpages@gmail.com> | 2022-09-05 23:03:38 +0200 |
|---|---|---|
| committer | Alejandro Colomar <alx.manpages@gmail.com> | 2022-09-05 23:03:47 +0200 |
| commit | 70ac1c4785fc1e158ab2349a962dba2526bf4fbc (patch) | |
| tree | bff270e2496dd284bccfc1271b43946f5d225224 /man/man3/pthread_exit.3 | |
| parent | 5423a6f86b2b920a5f3e8cf8d759b513050f2d33 (diff) | |
| download | man-pages-70ac1c4785fc1e158ab2349a962dba2526bf4fbc.tar.gz | |
src.mk, All pages: Move man* to man/
The root of the repository is becoming a bit overpopulated and
unorganized, due to the recent addition of more mandirs, and more
informative and configuration files too. Let's create a specific
mandir <man/> that contains the mandirs <man[1-8]*>.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Diffstat (limited to 'man/man3/pthread_exit.3')
| -rw-r--r-- | man/man3/pthread_exit.3 | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/man/man3/pthread_exit.3 b/man/man3/pthread_exit.3 new file mode 100644 index 0000000000..220a6dc0c7 --- /dev/null +++ b/man/man3/pthread_exit.3 @@ -0,0 +1,106 @@ +.\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk +.\" <mtk.manpages@gmail.com> +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH PTHREAD_EXIT 3 2021-03-22 "Linux man-pages (unreleased)" +.SH NAME +pthread_exit \- terminate calling thread +.SH LIBRARY +POSIX threads library +.RI ( libpthread ", " \-lpthread ) +.SH SYNOPSIS +.nf +.B #include <pthread.h> +.PP +.BI "noreturn void pthread_exit(void *" retval ); +.fi +.SH DESCRIPTION +The +.BR pthread_exit () +function terminates the calling thread and returns a value via +.I retval +that (if the thread is joinable) +is available to another thread in the same process that calls +.BR pthread_join (3). +.PP +Any clean-up handlers established by +.BR pthread_cleanup_push (3) +that have not yet been popped, +are popped (in the reverse of the order in which they were pushed) +and executed. +If the thread has any thread-specific data, then, +after the clean-up handlers have been executed, +the corresponding destructor functions are called, +in an unspecified order. +.PP +When a thread terminates, +process-shared resources (e.g., mutexes, condition variables, +semaphores, and file descriptors) are not released, +and functions registered using +.BR atexit (3) +are not called. +.PP +After the last thread in a process terminates, +the process terminates as by calling +.BR exit (3) +with an exit status of zero; +thus, process-shared resources +are released and functions registered using +.BR atexit (3) +are called. +.SH RETURN VALUE +This function does not return to the caller. +.SH ERRORS +This function always succeeds. +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.ad l +.nh +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.BR pthread_exit () +T} Thread safety MT-Safe +.TE +.hy +.ad +.sp 1 +.SH STANDARDS +POSIX.1-2001, POSIX.1-2008. +.SH NOTES +Performing a return from the start function of any thread other +than the main thread results in an implicit call to +.BR pthread_exit (), +using the function's return value as the thread's exit status. +.PP +To allow other threads to continue execution, +the main thread should terminate by calling +.BR pthread_exit () +rather than +.BR exit (3). +.PP +The value pointed to by +.I retval +should not be located on the calling thread's stack, +since the contents of that stack are undefined after the thread terminates. +.SH BUGS +Currently, +.\" Linux 2.6.27 +there are limitations in the kernel implementation logic for +.BR wait (2)ing +on a stopped thread group with a dead thread group leader. +This can manifest in problems such as a locked terminal if a stop signal is +sent to a foreground process whose thread group leader has already called +.BR pthread_exit (). +.\" FIXME . review a later kernel to see if this gets fixed +.\" http://thread.gmane.org/gmane.linux.kernel/611611 +.\" http://marc.info/?l=linux-kernel&m=122525468300823&w=2 +.SH SEE ALSO +.BR pthread_create (3), +.BR pthread_join (3), +.BR pthreads (7) |
