import less(1)
[unleashed/tickless.git] / share / man / man3c / pthread_mutexattr_getprioceiling.3c
blobbcd5aa3f17ef8fb070b2753196219c5e5dddcc45
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_MUTEXATTR_GETPRIOCEILING 3C "Apr 1, 2008"
13 .SH NAME
14 pthread_mutexattr_getprioceiling, pthread_mutexattr_setprioceiling \- get or
15 set prioceiling attribute of mutex attribute object
16 .SH SYNOPSIS
17 .LP
18 .nf
19 cc -mt [ \fIflag\fR... ] \fIfile\fR... -lpthread [ \fIlibrary\fR... ]
20 #include <pthread.h>
22 \fBint\fR \fBpthread_mutexattr_getprioceiling\fR(
23      \fBconst pthread_mutexattr_t *restrict\fR \fIattr\fR,
24      \fBint *restrict\fR \fIprioceiling\fR);
25 .fi
27 .LP
28 .nf
29 \fBint\fR \fBpthread_mutexattr_setprioceiling\fR(\fBpthread_mutexattr_t *\fR\fIattr\fR,
30      \fBint\fR \fIprioceiling\fR);
31 .fi
33 .SH DESCRIPTION
34 .sp
35 .LP
36 The \fBpthread_mutexattr_getprioceiling()\fR and
37 \fBpthread_mutexattr_setprioceiling()\fR functions, respectively, get and set
38 the priority ceiling attribute of a mutex attribute object pointed to by
39 \fIattr\fR, which was previously created by the \fBpthread_mutexattr_init()\fR
40 function.
41 .sp
42 .LP
43 The \fIprioceiling\fR attribute contains the priority ceiling of initialized
44 mutexes. The values of \fIprioceiling\fR must be within the range of priorities
45 defined by \fBSCHED_FIFO\fR.
46 .sp
47 .LP
48 The \fIprioceiling\fR attribute defines the priority ceiling of initialized
49 mutexes, which is the minimum priority level at which the critical section
50 guarded by the mutex is executed. In order to avoid priority inversion, the
51 priority ceiling of the mutex must be set to a priority higher than or equal to
52 the highest priority of all the threads that may lock that mutex.
53 .sp
54 .LP
55 The ceiling value should be drawn from the range of priorities for the
56 \fBSCHED_FIFO\fR policy. When a thread acquires such a mutex, the policy of the
57 thread at mutex acquisition should match that from which the ceiling value was
58 derived (\fBSCHED_FIFO\fR, in this case).    If a thread changes its scheduling
59 policy while holding a ceiling mutex, the  behavior of
60 \fBpthread_mutex_lock()\fR and \fBpthread_mutex_unlock()\fR on this mutex is
61 undefined. See \fBpthread_mutex_lock\fR(3C).
62 .SH RETURN VALUES
63 .sp
64 .LP
65 Upon successful completion, the \fBpthread_mutexattr_getprioceiling()\fR and
66 \fBpthread_mutexattr_setprioceiling()\fR functions return  \fB0\fR. Otherwise,
67 an error number is returned to indicate the error.
68 .SH ERRORS
69 .sp
70 .LP
71 The \fBpthread_mutexattr_setprioceiling()\fR function will fail if:
72 .sp
73 .ne 2
74 .na
75 \fB\fBEINVAL\fR\fR
76 .ad
77 .RS 10n
78 The value specified by \fIattr\fR is \fINULL\fR or \fIprioceiling\fR is
79 invalid.
80 .RE
82 .sp
83 .LP
84 The \fBpthread_mutexattr_getprioceiling()\fR and
85 \fBpthread_mutexattr_setprioceiling()\fR functions may fail if:
86 .sp
87 .ne 2
88 .na
89 \fB\fBEINVAL\fR\fR
90 .ad
91 .RS 10n
92 The value specified by \fIattr\fR or \fIprioceiling\fR is invalid.
93 .RE
95 .sp
96 .ne 2
97 .na
98 \fB\fBEPERM\fR\fR
99 .ad
100 .RS 10n
101 The caller does not have the privilege to perform the operation.
104 .SH ATTRIBUTES
107 See \fBattributes\fR(5) for descriptions of the following attributes:
112 box;
113 c | c
114 l | l .
115 ATTRIBUTE TYPE  ATTRIBUTE VALUE
117 Interface Stability     Committed
119 MT-Level        MT-Safe
121 Standard        See \fBstandards\fR(5).
124 .SH SEE ALSO
127 \fBpthread_cond_init\fR(3C), \fBpthread_create\fR(3C),
128 \fBpthread_mutex_init\fR(3C), \fBpthread_mutex_lock\fR(3C),
129 \fBsched_get_priority_min\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5)