9103 opengroup acknowledgement should be properly formatted in man pages
[unleashed.git] / usr / src / man / man3c / pthread_cleanup_push.3c
blobea860eb2745fbac0dadbc573ed666bee3adc2478
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 (c) 1991, 1992, 1994, The X/Open Company Ltd. All Rights Reserved.
44 .\" Copyright (c) 1995 IEEE.  All Rights Reserved.
45 .\" Copyright (c) 2001, The IEEE and The Open Group.  All Rights Reserved.
46 .\" Portions Copyright (c) 2008, Sun Microsystems, Inc.  All Rights Reserved.
47 .\"
48 .TH PTHREAD_CLEANUP_PUSH 3C "Nov 2, 2007"
49 .SH NAME
50 pthread_cleanup_push \- push 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_push\fR(\fBvoid (*\fR\fIhandler\fR) (void *), \fBvoid *\fR\fIarg\fR);
58 .fi
60 .SH DESCRIPTION
61 .sp
62 .LP
63 The \fBpthread_cleanup_push()\fR function pushes the specified cancellation
64 cleanup handler routine, \fIhandler\fR, onto the cancellation cleanup stack of
65 the calling thread.
66 .sp
67 .LP
68 When a thread exits or is canceled and its cancellation cleanup  stack is not
69 empty, the cleanup handlers are invoked with the argument  \fIarg\fR in  last
70 in, first out (LIFO) order from the cancellation cleanup stack.
71 .sp
72 .LP
73 An exiting or cancelled thread runs with all signals blocked. All thread
74 termination functions, including cancellation cleanup handlers, are called with
75 all signals blocked.
76 .sp
77 .LP
78 The \fBpthread_cleanup_push()\fR and \fBpthread_cleanup_pop\fR(3C) functions
79 can be implemented as macros. The application must ensure that they appear as
80 statements, and in pairs within the same lexical scope (that is, the
81 \fBpthread_cleanup_push()\fR macro can be thought to expand to a token list
82 whose first token is '{' with \fBpthread_cleanup_pop()\fR expanding to a token
83 list whose last token is the corresponding '}').
84 .sp
85 .LP
86 The effect of the use of \fBreturn\fR, \fBbreak\fR, \fBcontinue\fR, and
87 \fBgoto\fR to prematurely leave a code block described by a pair of
88 \fBpthread_cleanup_push()\fR and \fBpthread_cleanup_pop()\fR function calls is
89 undefined.
90 .sp
91 .LP
92 Using \fBlongjmp()\fR or \fBsiglongjmp()\fR to jump into or out of a push/pop
93 pair can cause either the matching push or the matching pop statement not
94 getting executed.
95 .SH RETURN VALUES
96 .sp
97 .LP
98 The \fBpthread_cleanup_push()\fR function returns no value.
99 .SH ERRORS
102 No errors are defined.
105 The  \fBpthread_cleanup_push()\fR function will not return an error code of
106 \fBEINTR\fR.
107 .SH ATTRIBUTES
110 See \fBattributes\fR(5) for descriptions of the following attributes:
115 box;
116 c | c
117 l | l .
118 ATTRIBUTE TYPE  ATTRIBUTE VALUE
120 Interface Stability     Committed
122 MT-Level        MT-Safe
124 Standard        See \fBstandards\fR(5).
127 .SH SEE ALSO
130 \fBlongjmp\fR(3C), \fBpthread_cancel\fR(3C), \fBpthread_cleanup_pop\fR(3C),
131 \fBpthread_exit\fR(3C), \fBpthread_join\fR(3C),
132 \fBpthread_setcancelstate\fR(3C), \fBpthread_setcanceltype\fR(3C),
133 \fBpthread_testcancel\fR(3C), \fBattributes\fR(5), \fBcancellation\fR(5),
134 \fBcondition\fR(5), \fBstandards\fR(5)
135 .SH NOTES
138 See \fBcancellation\fR(5) for a discussion of cancellation concepts.