Do not run mandoc for lintmanpages if MANPAGES is empty.
[netbsd-mini2440.git] / lib / libpthread / pthread_cleanup_push.3
blob85db183601c608e595f77e8eab26aaca0d22c753
1 .\" $NetBSD: pthread_cleanup_push.3,v 1.4 2003/07/04 08:42:20 wiz Exp $
2 .\"
3 .\" Copyright (c) 2002 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
14 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
15 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
17 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23 .\" POSSIBILITY OF SUCH DAMAGE.
24 .\"
25 .\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
26 .\" All rights reserved.
27 .\"
28 .\" Redistribution and use in source and binary forms, with or without
29 .\" modification, are permitted provided that the following conditions
30 .\" are met:
31 .\" 1. Redistributions of source code must retain the above copyright
32 .\"    notice, this list of conditions and the following disclaimer.
33 .\" 2. Redistributions in binary form must reproduce the above copyright
34 .\"    notice, this list of conditions and the following disclaimer in the
35 .\"    documentation and/or other materials provided with the distribution.
36 .\" 3. Neither the name of the author nor the names of any co-contributors
37 .\"    may be used to endorse or promote products derived from this software
38 .\"    without specific prior written permission.
39 .\"
40 .\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
41 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
43 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
44 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
45 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
46 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
48 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
49 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50 .\" SUCH DAMAGE.
51 .\"
52 .\" $FreeBSD: src/lib/libpthread/man/pthread_cleanup_push.3,v 1.11 2002/09/16 19:29:28 mini Exp $
53 .\"
54 .Dd January 30, 2003
55 .Dt PTHREAD_CLEANUP 3
56 .Os
57 .Sh NAME
58 .Nm pthread_cleanup_push ,
59 .Nm pthread_cleanup_pop
60 .Nd add and remove cleanup functions for thread exit
61 .Sh LIBRARY
62 .Lb libpthread
63 .Sh SYNOPSIS
64 .In pthread.h
65 .Ft void
66 .Fn pthread_cleanup_push "void \*[lp]*cleanup_routine\*[rp]\*[lp]void *\*[rp]" "void *arg"
67 .Ft void
68 .Fn pthread_cleanup_pop "int execute"
69 .Sh DESCRIPTION
70 The
71 .Fn pthread_cleanup_push
72 function adds
73 .Fa cleanup_routine
74 to the top of the stack of cleanup handlers that
75 get called when the current thread exits.
76 .Pp
77 The
78 .Fn pthread_cleanup_pop
79 function pops the top cleanup routine off of the current threads cleanup
80 routine stack, and, if
81 .Fa execute
82 is non-zero, it will execute the function.
83 .Pp
84 When
85 .Fa cleanup_routine
86 is called, it is passed
87 .Fa arg
88 as its only argument.
89 .Pp
90 These functions may be implemented as macros which contain scope delimiters;
91 therefore, there must be a matching
92 .Fn pthread_cleanup_pop
93 for every
94 .Fn pthread_cleanup_push
95 at the same level of lexical scoping.
96 .Pp
97 The effect of calling
98 .Fn longjmp
100 .Fn siglongjmp
101 is undefined after a call to
102 .Fn pthread_cleanup_push
103 but before the matching call to
104 .Fn pthread_cleanup_pop
105 after the jump buffer was filled.
106 .Sh RETURN VALUES
107 Neither
108 .Fn pthread_cleanup_push
110 .Fn pthread_cleanup_pop
111 returns a value.
112 .Sh ERRORS
113 None.
114 .Sh SEE ALSO
115 .Xr pthread_exit 3
116 .Sh STANDARDS
117 .Fn pthread_cleanup_push
119 .Fn pthread_cleanup_pop
120 conform to
121 .St -p1003.1-96 .