nightly: remove unused BINARCHIVE
[unleashed.git] / share / man / man3c / pthread_cleanup_pop.3c
blobaad1b8057adb89fc435a142ff6bcc9dc05b76a5a
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright 1991, 1992, 1994, The X/Open Company Ltd.
44 .\" Portions Copyright (c) 1995 IEEE.  All Rights Reserved.
45 .\" Copyright (c) 2001, The IEEE and The Open Group.  All Rights Reserved.
46 .\" Copyright (c) 2008, Sun Microsystems, Inc.  All Rights Reserved.
47 .\"
48 .TH PTHREAD_CLEANUP_POP 3C "Oct 4, 2005"
49 .SH NAME
50 pthread_cleanup_pop \- pop a thread cancellation cleanup handler
51 .SH SYNOPSIS
52 .LP
53 .nf
54 cc -mt [ \fIflag\fR... ] \fIfile\fR... -lpthread [ \fIlibrary\fR... ]
55 #include <pthread.h>
57 \fBvoid\fR \fBpthread_cleanup_pop\fR(\fBint\fR \fIexecute\fR);
58 .fi
60 .SH DESCRIPTION
61 .sp
62 .LP
63 The \fBpthread_cleanup_pop()\fR function removes the cleanup handler routine at
64 the top of the cancellation cleanup stack of the calling thread and executes it
65 if \fIexecute\fR is non-zero.
66 .sp
67 .LP
68 When the thread calls \fBpthread_cleanup_pop()\fR with a non-zero \fIexecute\fR
69 argument, the argument at the top of the stack is popped and executed. An
70 argument of  \fB0\fR pops the handler without executing it.
71 .sp
72 .LP
73 The \fBpthread_cleanup_push\fR(3C) and \fBpthread_cleanup_pop()\fR functions
74 can be implemented as macros. The application must ensure that they appear as
75 statements, and in pairs within the same lexical scope (that is, the
76 \fBpthread_cleanup_push()\fR macro can be thought to expand to a token list
77 whose first token is '{' with \fBpthread_cleanup_pop()\fR expanding to a token
78 list whose last token is the corresponding '}').
79 .sp
80 .LP
81 The effect of the use of \fBreturn\fR, \fBbreak\fR, \fBcontinue\fR, and
82 \fBgoto\fR to prematurely leave a code block described by a pair of
83 \fBpthread_cleanup_push()\fR and \fBpthread_cleanup_pop()\fR function calls is
84 undefined.
85 .sp
86 .LP
87 Using \fBlongjmp()\fR or \fBsiglongjmp()\fR to jump into or out of a push/pop
88 pair can result in either the matching push or the matching pop statement not
89 getting executed.
90 .SH RETURN VALUES
91 .sp
92 .LP
93 The \fBpthread_cleanup_pop()\fR function returns no value.
94 .SH ERRORS
95 .sp
96 .LP
97 No errors are defined.
98 .sp
99 .LP
100 The \fBpthread_cleanup_pop()\fR function will not return an error code of
101 \fBEINTR\fR.
102 .SH ATTRIBUTES
105 See \fBattributes\fR(5) for descriptions of the following attributes:
110 box;
111 c | c
112 l | l .
113 ATTRIBUTE TYPE  ATTRIBUTE VALUE
115 Interface Stability     Standard
117 MT-Level        MT-Safe
120 .SH SEE ALSO
123 \fBpthread_cancel\fR(3C), \fBpthread_cleanup_push\fR(3C),
124 \fBpthread_exit\fR(3C), \fBpthread_join\fR(3C),
125 \fBpthread_setcancelstate\fR(3C), \fBpthread_setcanceltype\fR(3C),
126 \fBpthread_testcancel\fR(3C), \fBsetjmp\fR(3C), \fBattributes\fR(5),
127 \fBcancellation\fR(5), \fBcondition\fR(5), \fBstandards\fR(5)
128 .SH NOTES
131 See \fBcancellation\fR(5) for a discussion of cancellation concepts.