1PTHREAD_MUTEXATTR_GETPROTOCOPLO(S3IPX)Programmer'sPMTaHnRuEaAlD_MUTEXATTR_GETPROTOCOL(3P)
2
3
4

PROLOG

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
11

NAME

13       pthread_mutexattr_getprotocol, pthread_mutexattr_setprotocol — get  and
14       set  the  protocol  attribute  of the mutex attributes object (REALTIME
15       THREADS)
16

SYNOPSIS

18       #include <pthread.h>
19
20       int pthread_mutexattr_getprotocol(const pthread_mutexattr_t
21           *restrict attr, int *restrict protocol);
22       int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr,
23           int protocol);
24

DESCRIPTION

26       The pthread_mutexattr_getprotocol() and pthread_mutexattr_setprotocol()
27       functions,  respectively, shall get and set the protocol attribute of a
28       mutex attributes object pointed to by attr which was previously created
29       by the function pthread_mutexattr_init().
30
31       The protocol attribute defines the protocol to be followed in utilizing
32       mutexes.  The value of protocol may be one of:
33
34       PTHREAD_PRIO_INHERIT
35       PTHREAD_PRIO_NONE
36       PTHREAD_PRIO_PROTECT
37
38       which are defined in the <pthread.h> header. The default value  of  the
39       attribute shall be PTHREAD_PRIO_NONE.
40
41       When  a  thread  owns  a  mutex  with  the  PTHREAD_PRIO_NONE  protocol
42       attribute, its priority and scheduling shall not  be  affected  by  its
43       mutex ownership.
44
45       When a thread is blocking higher priority threads because of owning one
46       or  more  robust  mutexes  with   the   PTHREAD_PRIO_INHERIT   protocol
47       attribute, it shall execute at the higher of its priority or the prior‐
48       ity of the highest priority thread waiting on any of the robust mutexes
49       owned by this thread and initialized with this protocol.
50
51       When a thread is blocking higher priority threads because of owning one
52       or more  non-robust  mutexes  with  the  PTHREAD_PRIO_INHERIT  protocol
53       attribute, it shall execute at the higher of its priority or the prior‐
54       ity of the highest priority thread waiting on  any  of  the  non-robust
55       mutexes owned by this thread and initialized with this protocol.
56
57       When  a  thread  owns  one  or more robust mutexes initialized with the
58       PTHREAD_PRIO_PROTECT protocol, it shall execute at the  higher  of  its
59       priority  or  the  highest  of  the priority ceilings of all the robust
60       mutexes owned by this  thread  and  initialized  with  this  attribute,
61       regardless  of whether other threads are blocked on any of these robust
62       mutexes or not.
63
64       When a thread owns one or more non-robust mutexes initialized with  the
65       PTHREAD_PRIO_PROTECT  protocol,  it  shall execute at the higher of its
66       priority or the highest of the priority ceilings of all the  non-robust
67       mutexes  owned  by  this  thread  and  initialized with this attribute,
68       regardless of whether other threads are blocked on any  of  these  non-
69       robust mutexes or not.
70
71       While  a  thread is holding a mutex which has been initialized with the
72       PTHREAD_PRIO_INHERIT or PTHREAD_PRIO_PROTECT  protocol  attributes,  it
73       shall not be subject to being moved to the tail of the scheduling queue
74       at its priority in the event that its  original  priority  is  changed,
75       such as by a call to sched_setparam().  Likewise, when a thread unlocks
76       a mutex that has been  initialized  with  the  PTHREAD_PRIO_INHERIT  or
77       PTHREAD_PRIO_PROTECT  protocol  attributes,  it shall not be subject to
78       being moved to the tail of the scheduling queue at its priority in  the
79       event that its original priority is changed.
80
81       If  a  thread simultaneously owns several mutexes initialized with dif‐
82       ferent protocols, it shall execute at the  highest  of  the  priorities
83       that it would have obtained by each of these protocols.
84
85       When  a thread makes a call to pthread_mutex_lock(), the mutex was ini‐
86       tialized   with   the   protocol    attribute    having    the    value
87       PTHREAD_PRIO_INHERIT,  when  the  calling thread is blocked because the
88       mutex is owned by another thread, that owner thread shall  inherit  the
89       priority level of the calling thread as long as it continues to own the
90       mutex. The implementation shall update its execution  priority  to  the
91       maximum  of  its  assigned  priority  and all its inherited priorities.
92       Furthermore, if this owner thread itself  becomes  blocked  on  another
93       mutex    with    the    protocol    attribute    having    the    value
94       PTHREAD_PRIO_INHERIT, the same priority  inheritance  effect  shall  be
95       propagated to this other owner thread, in a recursive manner.
96
97       The  behavior  is undefined if the value specified by the attr argument
98       to pthread_mutexattr_getprotocol()  or  pthread_mutexattr_setprotocol()
99       does not refer to an initialized mutex attributes object.
100

RETURN VALUE

102       Upon  successful  completion,  the  pthread_mutexattr_getprotocol() and
103       pthread_mutexattr_setprotocol() functions shall return zero; otherwise,
104       an error number shall be returned to indicate the error.
105

ERRORS

107       The pthread_mutexattr_setprotocol() function shall fail if:
108
109       ENOTSUP
110              The value specified by protocol is an unsupported value.
111
112       The pthread_mutexattr_getprotocol() and pthread_mutexattr_setprotocol()
113       functions may fail if:
114
115       EINVAL The value specified by protocol is invalid.
116
117       EPERM  The caller does not have the privilege to perform the operation.
118
119       These functions shall not return an error code of [EINTR].
120
121       The following sections are informative.
122

EXAMPLES

124       None.
125

APPLICATION USAGE

127       None.
128

RATIONALE

130       If an implementation detects that the value specified by the attr argu‐
131       ment  to pthread_mutexattr_getprotocol() or pthread_mutexattr_setproto‐
132       col() does not refer to an initialized mutex attributes object,  it  is
133       recommended that the function should fail and report an [EINVAL] error.
134

FUTURE DIRECTIONS

136       None.
137

SEE ALSO

139       pthread_cond_destroy(), pthread_create(), pthread_mutex_destroy()
140
141       The Base Definitions volume of POSIX.1‐2008, <pthread.h>
142
144       Portions  of  this text are reprinted and reproduced in electronic form
145       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
146       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
147       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
148       cal  and  Electronics  Engineers,  Inc  and  The  Open Group.  (This is
149       POSIX.1-2008 with the 2013 Technical Corrigendum  1  applied.)  In  the
150       event of any discrepancy between this version and the original IEEE and
151       The Open Group Standard, the original IEEE and The Open Group  Standard
152       is  the  referee document. The original Standard can be obtained online
153       at http://www.unix.org/online.html .
154
155       Any typographical or formatting errors that appear  in  this  page  are
156       most likely to have been introduced during the conversion of the source
157       files to man page format. To report such errors,  see  https://www.ker
158       nel.org/doc/man-pages/reporting_bugs.html .
159
160
161
162IEEE/The Open Group                  2013    PTHREAD_MUTEXATTR_GETPROTOCOL(3P)
Impressum