Unleashed v1.4
[unleashed.git] / share / man / man3c / pthread_mutexattr_getprioceiling.3c
blobd66bb7ad73052e6e7298212106a76e32c3d77335
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 .\" Copyright (c) 2001, The IEEE and The Open Group.  All Rights Reserved.
45 .\" Copyright (c) 2008, Sun Microsystems, Inc.  All Rights Reserved.
46 .\"
47 .TH PTHREAD_MUTEXATTR_GETPRIOCEILING 3C "Apr 1, 2008"
48 .SH NAME
49 pthread_mutexattr_getprioceiling, pthread_mutexattr_setprioceiling \- get or
50 set prioceiling attribute of mutex attribute object
51 .SH SYNOPSIS
52 .LP
53 .nf
54 cc -mt [ \fIflag\fR... ] \fIfile\fR... -lpthread [ \fIlibrary\fR... ]
55 #include <pthread.h>
57 \fBint\fR \fBpthread_mutexattr_getprioceiling\fR(
58      \fBconst pthread_mutexattr_t *restrict\fR \fIattr\fR,
59      \fBint *restrict\fR \fIprioceiling\fR);
60 .fi
62 .LP
63 .nf
64 \fBint\fR \fBpthread_mutexattr_setprioceiling\fR(\fBpthread_mutexattr_t *\fR\fIattr\fR,
65      \fBint\fR \fIprioceiling\fR);
66 .fi
68 .SH DESCRIPTION
69 .sp
70 .LP
71 The \fBpthread_mutexattr_getprioceiling()\fR and
72 \fBpthread_mutexattr_setprioceiling()\fR functions, respectively, get and set
73 the priority ceiling attribute of a mutex attribute object pointed to by
74 \fIattr\fR, which was previously created by the \fBpthread_mutexattr_init()\fR
75 function.
76 .sp
77 .LP
78 The \fIprioceiling\fR attribute contains the priority ceiling of initialized
79 mutexes. The values of \fIprioceiling\fR must be within the range of priorities
80 defined by \fBSCHED_FIFO\fR.
81 .sp
82 .LP
83 The \fIprioceiling\fR attribute defines the priority ceiling of initialized
84 mutexes, which is the minimum priority level at which the critical section
85 guarded by the mutex is executed. In order to avoid priority inversion, the
86 priority ceiling of the mutex must be set to a priority higher than or equal to
87 the highest priority of all the threads that may lock that mutex.
88 .sp
89 .LP
90 The ceiling value should be drawn from the range of priorities for the
91 \fBSCHED_FIFO\fR policy. When a thread acquires such a mutex, the policy of the
92 thread at mutex acquisition should match that from which the ceiling value was
93 derived (\fBSCHED_FIFO\fR, in this case).    If a thread changes its scheduling
94 policy while holding a ceiling mutex, the  behavior of
95 \fBpthread_mutex_lock()\fR and \fBpthread_mutex_unlock()\fR on this mutex is
96 undefined. See \fBpthread_mutex_lock\fR(3C).
97 .SH RETURN VALUES
98 .sp
99 .LP
100 Upon successful completion, the \fBpthread_mutexattr_getprioceiling()\fR and
101 \fBpthread_mutexattr_setprioceiling()\fR functions return  \fB0\fR. Otherwise,
102 an error number is returned to indicate the error.
103 .SH ERRORS
106 The \fBpthread_mutexattr_setprioceiling()\fR function will fail if:
108 .ne 2
110 \fB\fBEINVAL\fR\fR
112 .RS 10n
113 The value specified by \fIattr\fR is \fINULL\fR or \fIprioceiling\fR is
114 invalid.
119 The \fBpthread_mutexattr_getprioceiling()\fR and
120 \fBpthread_mutexattr_setprioceiling()\fR functions may fail if:
122 .ne 2
124 \fB\fBEINVAL\fR\fR
126 .RS 10n
127 The value specified by \fIattr\fR or \fIprioceiling\fR is invalid.
131 .ne 2
133 \fB\fBEPERM\fR\fR
135 .RS 10n
136 The caller does not have the privilege to perform the operation.
139 .SH ATTRIBUTES
142 See \fBattributes\fR(5) for descriptions of the following attributes:
147 box;
148 c | c
149 l | l .
150 ATTRIBUTE TYPE  ATTRIBUTE VALUE
152 Interface Stability     Committed
154 MT-Level        MT-Safe
156 Standard        See \fBstandards\fR(5).
159 .SH SEE ALSO
162 \fBpthread_cond_init\fR(3C), \fBpthread_create\fR(3C),
163 \fBpthread_mutex_init\fR(3C), \fBpthread_mutex_lock\fR(3C),
164 \fBsched_get_priority_min\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5)