1951 leaking a vdev when removing an l2cache device
[unleashed.git] / usr / src / man / man3c / pthread_setcancelstate.3c
blobc5d13dc2427618b93011768f5aa2279bd7371f5e
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 .\" Portions Copyright (c) 1995 IEEE  All Rights Reserved.
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_SETCANCELSTATE 3C "Jan 22, 2008"
13 .SH NAME
14 pthread_setcancelstate \- enable or disable cancellation
15 .SH SYNOPSIS
16 .LP
17 .nf
18 cc -mt [ \fIflag\fR... ] \fIfile\fR... -lpthread [ \fIlibrary\fR... ]
19 #include <pthread.h>
21 \fBint\fR \fBpthread_setcancelstate\fR(\fBint\fR \fIstate\fR, \fBint *\fR\fIoldstate\fR);
22 .fi
24 .SH DESCRIPTION
25 .sp
26 .LP
27 The \fBpthread_setcancelstate()\fR function atomically sets the calling
28 thread's cancellation state to the specified \fIstate\fR and if \fIoldstate\fR
29 is not \fINULL\fR, stores the previous cancellation \fIstate\fR in
30 \fIoldstate\fR.
31 .sp
32 .LP
33 The \fIstate\fR can be either of the following:
34 .sp
35 .ne 2
36 .na
37 \fB\fBPTHREAD_CANCEL_ENABLE\fR\fR
38 .ad
39 .sp .6
40 .RS 4n
41 This is the default. When cancellation is deferred (deferred cancellation is
42 also the default), cancellation occurs when the target thread reaches a
43 cancellation point and a cancel is pending. When cancellation is asynchronous,
44 receipt of a  \fBpthread_cancel\fR(3C) call causes immediate cancellation.
45 .RE
47 .sp
48 .ne 2
49 .na
50 \fB\fBPTHREAD_CANCEL_DISABLE\fR\fR
51 .ad
52 .sp .6
53 .RS 4n
54 When cancellation is deferred, all cancellation requests to the target thread
55 are held pending. When cancellation is asynchronous, all cancellation requests
56 to the target thread are held pending; as soon as cancellation is re-enabled,
57 pending cancellations are executed immediately.
58 .RE
60 .sp
61 .LP
62 See \fBcancellation\fR(5) for the definition of a cancellation point and a
63 discussion of cancellation concepts. See \fBpthread_setcanceltype\fR(3C) for
64 explanations of deferred and asynchronous cancellation.
65 .SH RETURN VALUES
66 .sp
67 .LP
68 Upon successful completion, \fBpthread_setcancelstate()\fR, returns \fB0\fR.
69 Otherwise, an error number is returned to indicate the error.
70 .SH ERRORS
71 .sp
72 .LP
73 The \fBpthread_setcancelstate()\fR function will fail if:
74 .sp
75 .ne 2
76 .na
77 \fB\fBEINVAL\fR\fR
78 .ad
79 .RS 10n
80 The specified \fIstate\fR is not \fBPTHREAD_CANCEL_ENABLE\fR or
81 \fBPTHREAD_CANCEL_DISABLE\fR.
82 .RE
84 .SH ATTRIBUTES
85 .sp
86 .LP
87 See \fBattributes\fR(5) for descriptions of the following attributes:
88 .sp
90 .sp
91 .TS
92 box;
93 c | c
94 l | l .
95 ATTRIBUTE TYPE  ATTRIBUTE VALUE
97 Interface Stability     Committed
99 MT-Level        MT-Safe
101 Standard        See \fBstandards\fR(5).
104 .SH SEE ALSO
107 \fBpthread_cancel\fR(3C), \fBpthread_cleanup_pop\fR(3C),
108 \fBpthread_cleanup_push\fR(3C), \fBpthread_exit\fR(3C), \fBpthread_join\fR(3C),
109 \fBpthread_setcanceltype\fR(3C), \fBpthread_testcancel\fR(3C),
110 \fBsetjmp\fR(3C), \fBattributes\fR(5), \fBcancellation\fR(5),
111 \fBcondition\fR(5), \fBstandards\fR(5)