1PTHREAD_MUTEXATTR_GETPROTOCOPLO(S3IPX)Programmer'sPMTaHnRuEaAlD_MUTEXATTR_GETPROTOCOL(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 pthread_mutexattr_getprotocol, pthread_mutexattr_setprotocol - get and
13 set the protocol attribute of the mutex attributes object (REALTIME
14 THREADS)
15
17 #include <pthread.h>
18
19 int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *
20 restrict attr, int *restrict protocol);
21 int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr,
22 int protocol);
23
24
25
26
28 The pthread_mutexattr_getprotocol() and pthread_mutexattr_setprotocol()
29 functions, respectively, shall get and set the protocol attribute of a
30 mutex attributes object pointed to by attr which was previously created
31 by the function pthread_mutexattr_init().
32
33 The protocol attribute defines the protocol to be followed in utilizing
34 mutexes. The value of protocol may be one of:
35
36 PTHREAD_PRIO_NONE
37
38 PTHREAD_PRIO_INHERIT
39
40
41 PTHREAD_PRIO_PROTECT
42
43
44 which are defined in the <pthread.h> header.
45
46 When a thread owns a mutex with the PTHREAD_PRIO_NONE protocol
47 attribute, its priority and scheduling shall not be affected by its
48 mutex ownership.
49
50 When a thread is blocking higher priority threads because of owning one
51 or more mutexes with the PTHREAD_PRIO_INHERIT protocol attribute, it
52 shall execute at the higher of its priority or the priority of the
53 highest priority thread waiting on any of the mutexes owned by this
54 thread and initialized with this protocol.
55
56 When a thread owns one or more mutexes initialized with the
57 PTHREAD_PRIO_PROTECT protocol, it shall execute at the higher of its
58 priority or the highest of the priority ceilings of all the mutexes
59 owned by this thread and initialized with this attribute, regardless of
60 whether other threads are blocked on any of these mutexes or not.
61
62 While a thread is holding a mutex which has been initialized with the
63 PTHREAD_PRIO_INHERIT or PTHREAD_PRIO_PROTECT protocol attributes, it
64 shall not be subject to being moved to the tail of the scheduling queue
65 at its priority in the event that its original priority is changed,
66 such as by a call to sched_setparam(). Likewise, when a thread unlocks
67 a mutex that has been initialized with the PTHREAD_PRIO_INHERIT or
68 PTHREAD_PRIO_PROTECT protocol attributes, it shall not be subject to
69 being moved to the tail of the scheduling queue at its priority in the
70 event that its original priority is changed.
71
72 If a thread simultaneously owns several mutexes initialized with dif‐
73 ferent protocols, it shall execute at the highest of the priorities
74 that it would have obtained by each of these protocols.
75
76 When a thread makes a call to pthread_mutex_lock(), the mutex was ini‐
77 tialized with the protocol attribute having the value
78 PTHREAD_PRIO_INHERIT, when the calling thread is blocked because the
79 mutex is owned by another thread, that owner thread shall inherit the
80 priority level of the calling thread as long as it continues to own the
81 mutex. The implementation shall update its execution priority to the
82 maximum of its assigned priority and all its inherited priorities. Fur‐
83 thermore, if this owner thread itself becomes blocked on another mutex,
84 the same priority inheritance effect shall be propagated to this other
85 owner thread, in a recursive manner.
86
88 Upon successful completion, the pthread_mutexattr_getprotocol() and
89 pthread_mutexattr_setprotocol() functions shall return zero; otherwise,
90 an error number shall be returned to indicate the error.
91
93 The pthread_mutexattr_setprotocol() function shall fail if:
94
95 ENOTSUP
96 The value specified by protocol is an unsupported value.
97
98
99 The pthread_mutexattr_getprotocol() and pthread_mutexattr_setprotocol()
100 functions may fail if:
101
102 EINVAL The value specified by attr or protocol is invalid.
103
104 EPERM The caller does not have the privilege to perform the operation.
105
106
107 These functions shall not return an error code of [EINTR].
108
109 The following sections are informative.
110
112 None.
113
115 None.
116
118 None.
119
121 None.
122
124 pthread_cond_destroy(), pthread_create(), pthread_mutex_destroy(), the
125 Base Definitions volume of IEEE Std 1003.1-2001, <pthread.h>
126
128 Portions of this text are reprinted and reproduced in electronic form
129 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
130 -- Portable Operating System Interface (POSIX), The Open Group Base
131 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
132 Electrical and Electronics Engineers, Inc and The Open Group. In the
133 event of any discrepancy between this version and the original IEEE and
134 The Open Group Standard, the original IEEE and The Open Group Standard
135 is the referee document. The original Standard can be obtained online
136 at http://www.opengroup.org/unix/online.html .
137
138
139
140IEEE/The Open Group 2003 PTHREAD_MUTEXATTR_GETPROTOCOL(3P)