1 .\" $NetBSD: pthread_mutex.3,v 1.10 2017/10/22 16:37:24 abhinav Exp $
3 .\" Copyright (c) 2002, 2010 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 .\" POSSIBILITY OF SUCH DAMAGE.
27 .\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
28 .\" All rights reserved.
30 .\" Redistribution and use in source and binary forms, with or without
31 .\" modification, are permitted provided that the following conditions
33 .\" 1. Redistributions of source code must retain the above copyright
34 .\" notice, this list of conditions and the following disclaimer.
35 .\" 2. Redistributions in binary form must reproduce the above copyright
36 .\" notice, this list of conditions and the following disclaimer in the
37 .\" documentation and/or other materials provided with the distribution.
38 .\" 3. Neither the name of the author nor the names of any co-contributors
39 .\" may be used to endorse or promote products derived from this software
40 .\" without specific prior written permission.
42 .\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
43 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
44 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
45 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
46 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
47 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
48 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
49 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
50 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
51 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55 .Dt PTHREAD_MUTEX_GETPRIOCEILING 3
58 .Nm pthread_mutex_getprioceiling ,
59 .Nm pthread_mutex_setprioceiling
60 .Nd get or set the priority ceiling of a mutex
66 .Fn pthread_mutex_getprioceiling "const pthread_mutex_t * restrict mutex" "int * restrict prioceiling"
68 .Fn pthread_mutex_setprioceiling "pthread_mutex_t * restrict mutex" "int prioceiling" "int * restrict old_ceiling"
71 .Fn pthread_mutex_getprioceiling
72 function shall return the current priority ceiling of the mutex.
75 .Fn pthread_mutex_setprioceiling
76 function shall either lock the mutex if it is unlocked, or block until
77 it can successfully lock the mutex, then it shall change the mutex's priority
78 ceiling and release the mutex.
79 When the change is successful, the previous value of the priority ceiling
83 The process of locking the mutex need not adhere to the priority
86 .Fn pthread_mutex_setprioceiling
87 function fails, the mutex priority ceiling shall not be changed.
89 If successful, these functions return 0.
90 Otherwise, an error number is returned to indicate the error.
93 .Fn pthread_mutex_getprioceiling
95 .Fn pthread_mutex_setprioceiling
96 functions will fail if:
99 The priority requested by
102 the value specified by
104 does not refer to a currently existing mutex.
106 The caller does not have the privilege to perform the operation.
109 .Xr pthread_mutex_destroy 3 ,
110 .Xr pthread_mutex_init 3 ,
111 .Xr pthread_mutex_lock 3 ,
112 .Xr pthread_mutex_timedlock 3 ,
113 .Xr pthread_mutex_trylock 3 ,
114 .Xr pthread_mutex_unlock 3