1951 leaking a vdev when removing an l2cache device
[unleashed.git] / usr / src / man / man3c / pthread_exit.3c
blobb4709907bad1a98e45e3955752743cba6adc7422
1 '\" te
2 .\" Copyright (c) 2008, Sun Microsystems, Inc.  All Rights Reserved.
3 .\" Copyright (c) 2001, the Institute of Electrical and Electronics Engineers, Inc. and The Open Group. All Rights Reserved.
4 .\" Copyright 1991, 1992, 1994, The X/Open Company Ltd.
5 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
6 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
8 .\"  This notice shall appear on any product containing this material.
9 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
10 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
11 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
12 .TH PTHREAD_EXIT 3C "Nov 2, 2007"
13 .SH NAME
14 pthread_exit \- terminate calling thread
15 .SH SYNOPSIS
16 .LP
17 .nf
18 cc -mt [ \fIflag\fR... ] \fIfile\fR... -lpthread [ \fIlibrary\fR... ]
19 #include <pthread.h>
21 \fBvoid\fR \fBpthread_exit\fR(\fBvoid *\fR\fIvalue_ptr\fR);
22 .fi
24 .SH DESCRIPTION
25 .sp
26 .LP
27 The \fBpthread_exit()\fR function terminates the calling thread, in a similar
28 way that \fBexit\fR(3C) terminates the calling process. If the thread is not
29 detached, the exit status specified by  \fIvalue_ptr\fR is made  available to
30 any successful join with the terminating thread. See \fBpthread_join\fR(3C).
31 Any cancellation cleanup handlers that have been pushed and not yet popped are
32 popped in the reverse order that they were pushed and then executed. After all
33 cancellation cleanup handlers have been executed, if the thread has any
34 thread-specific data, appropriate destructor functions will be called in an
35 unspecified order. Thread termination does not release any application visible
36 process resources, including, but not limited to, mutexes and file descriptors,
37 nor does it perform any process level cleanup actions, including, but not
38 limited to, calling any \fBatexit()\fR routines that might exist.
39 .sp
40 .LP
41 An exiting thread runs with all signals blocked. All thread termination
42 functions, including cancellation cleanup handlers and thread-specific data
43 destructor functions, are called with all signals blocked.
44 .sp
45 .LP
46 An implicit call to \fBpthread_exit()\fR is made when a thread other than the
47 thread in which \fBmain()\fR was first invoked returns from the start routine
48 that was used to create it. The function's return value serves as the thread's
49 exit status.
50 .sp
51 .LP
52 The behavior of \fBpthread_exit()\fR is undefined if called from a cancellation
53 cleanup handler or destructor function that was invoked as a result of either
54 an implicit or explicit call to \fBpthread_exit()\fR.
55 .sp
56 .LP
57 After a thread has terminated, the result of access to local (auto) variables
58 of the thread is undefined. Thus, references to local variables of the exiting
59 thread should not be used for the \fBpthread_exit()\fR \fIvalue_ptr\fR
60 parameter value.
61 .sp
62 .LP
63 The process exits with an exit status of  \fB0\fR after the last thread has
64 been terminated. The behavior is as if the implementation called \fBexit()\fR
65 with a \fB0\fR argument at thread termination time.
66 .SH RETURN VALUES
67 .sp
68 .LP
69 The \fBpthread_exit()\fR function cannot return to its caller.
70 .SH ERRORS
71 .sp
72 .LP
73 No errors are defined.
74 .SH ATTRIBUTES
75 .sp
76 .LP
77 See \fBattributes\fR(5) for descriptions of the following attributes:
78 .sp
80 .sp
81 .TS
82 box;
83 c | c
84 l | l .
85 ATTRIBUTE TYPE  ATTRIBUTE VALUE
87 Interface Stability     Committed
89 MT-Level        MT-Safe
91 Standard        See \fBstandards\fR(5).
92 .TE
94 .SH SEE ALSO
95 .sp
96 .LP
97 \fBexit\fR(3C), \fBpthread_cancel\fR(3C), \fBpthread_create\fR(3C),
98 \fBpthread_join\fR(3C), \fBpthread_key_create\fR(3C), \fBattributes\fR(5),
99 \fBstandards\fR(5)