208 lines
9.3 KiB
HTML
208 lines
9.3 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
|
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
|
<title>pthread_mutexattr_getprotocol</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
|
</script>
|
|
|
|
<basefont size="3"> <a name="pthread_mutexattr_getprotocol"></a> <a name="tag_03_546"></a><!-- pthread_mutexattr_getprotocol -->
|
|
<!--header start-->
|
|
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
|
IEEE Std 1003.1-2001<br>
|
|
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
|
|
|
<!--header end-->
|
|
<hr size="2" noshade>
|
|
<h4><a name="tag_03_546_01"></a>NAME</h4>
|
|
|
|
<blockquote>pthread_mutexattr_getprotocol, pthread_mutexattr_setprotocol - get and set the protocol attribute of the mutex
|
|
attributes object (<b>REALTIME THREADS</b>)</blockquote>
|
|
|
|
<h4><a name="tag_03_546_02"></a>SYNOPSIS</h4>
|
|
|
|
<blockquote class="synopsis">
|
|
<div class="box"><code><tt><sup>[<a href="javascript:open_code('THR')">THR</a>]</sup> <img src="../images/opt-start.gif" alt=
|
|
"[Option Start]" border="0"> #include <<a href="../basedefs/pthread.h.html">pthread.h</a>><br>
|
|
<br>
|
|
|
|
<tt><sup>[<a href="javascript:open_code('TPP')">TPP|TPI</a>]</sup> <img src="../images/opt-start.gif" alt=
|
|
"[Option Start]" border="0"> int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *<br>
|
|
restrict</tt> <i>attr</i><tt>, int *restrict</tt> <i>protocol</i><tt>);<br>
|
|
int pthread_mutexattr_setprotocol(pthread_mutexattr_t *</tt><i>attr</i><tt>,<br>
|
|
int</tt> <i>protocol</i><tt>); <img src="../images/opt-end.gif" alt="[Option End]" border=
|
|
"0"></tt>
|
|
<br>
|
|
<img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div>
|
|
|
|
<tt><br>
|
|
</tt></blockquote>
|
|
|
|
<h4><a name="tag_03_546_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>pthread_mutexattr_getprotocol</i>() and <i>pthread_mutexattr_setprotocol</i>() functions, respectively, shall get and set
|
|
the protocol attribute of a mutex attributes object pointed to by <i>attr</i> which was previously created by the function <a href=
|
|
"../functions/pthread_mutexattr_init.html"><i>pthread_mutexattr_init</i>()</a>.</p>
|
|
|
|
<p>The <i>protocol</i> attribute defines the protocol to be followed in utilizing mutexes. The value of <i>protocol</i> may be one
|
|
of:</p>
|
|
|
|
<p><br>
|
|
PTHREAD_PRIO_NONE<br>
|
|
<sup>[<a href="javascript:open_code('TPI')">TPI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"><br>
|
|
PTHREAD_PRIO_INHERIT<br>
|
|
<img src="../images/opt-end.gif" alt="[Option End]" border="0"><br>
|
|
<sup>[<a href="javascript:open_code('TPP')">TPP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"><br>
|
|
PTHREAD_PRIO_PROTECT<br>
|
|
<img src="../images/opt-end.gif" alt="[Option End]" border="0"><br>
|
|
</p>
|
|
|
|
<p>which are defined in the <a href="../basedefs/pthread.h.html"><i><pthread.h></i></a> header.</p>
|
|
|
|
<p>When a thread owns a mutex with the PTHREAD_PRIO_NONE <i>protocol</i> attribute, its priority and scheduling shall not be
|
|
affected by its mutex ownership.</p>
|
|
|
|
<p><sup>[<a href="javascript:open_code('TPI')">TPI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
When a thread is blocking higher priority threads because of owning one or more mutexes with the PTHREAD_PRIO_INHERIT
|
|
<i>protocol</i> attribute, it shall execute at the higher of its priority or the priority of the highest priority thread waiting on
|
|
any of the mutexes owned by this thread and initialized with this protocol. <img src="../images/opt-end.gif" alt="[Option End]"
|
|
border="0"></p>
|
|
|
|
<p><sup>[<a href="javascript:open_code('TPP')">TPP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
When a thread owns one or more mutexes initialized with the PTHREAD_PRIO_PROTECT protocol, it shall execute at the higher of its
|
|
priority or the highest of the priority ceilings of all the mutexes owned by this thread and initialized with this attribute,
|
|
regardless of whether other threads are blocked on any of these mutexes or not. <img src="../images/opt-end.gif" alt="[Option End]"
|
|
border="0"></p>
|
|
|
|
<p>While a thread is holding a mutex which has been initialized with the PTHREAD_PRIO_INHERIT or PTHREAD_PRIO_PROTECT protocol
|
|
attributes, it shall not be subject to being moved to the tail of the scheduling queue at its priority in the event that its
|
|
original priority is changed, such as by a call to <a href="../functions/sched_setparam.html"><i>sched_setparam</i>()</a>.
|
|
Likewise, when a thread unlocks a mutex that has been initialized with the PTHREAD_PRIO_INHERIT or PTHREAD_PRIO_PROTECT protocol
|
|
attributes, it shall not be subject to being moved to the tail of the scheduling queue at its priority in the event that its
|
|
original priority is changed.</p>
|
|
|
|
<p>If a thread simultaneously owns several mutexes initialized with different protocols, it shall execute at the highest of the
|
|
priorities that it would have obtained by each of these protocols.</p>
|
|
|
|
<p><sup>[<a href="javascript:open_code('TPI')">TPI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
When a thread makes a call to <a href="../functions/pthread_mutex_lock.html"><i>pthread_mutex_lock</i>()</a>, the mutex was
|
|
initialized with the protocol attribute having the value PTHREAD_PRIO_INHERIT, when the calling thread is blocked because the mutex
|
|
is owned by another thread, that owner thread shall inherit the priority level of the calling thread as long as it continues to own
|
|
the mutex. The implementation shall update its execution priority to the maximum of its assigned priority and all its inherited
|
|
priorities. Furthermore, if this owner thread itself becomes blocked on another mutex, the same priority inheritance effect shall
|
|
be propagated to this other owner thread, in a recursive manner. <img src="../images/opt-end.gif" alt="[Option End]" border=
|
|
"0"></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_546_04"></a>RETURN VALUE</h4>
|
|
|
|
<blockquote>
|
|
<p>Upon successful completion, the <i>pthread_mutexattr_getprotocol</i>() and <i>pthread_mutexattr_setprotocol</i>() functions
|
|
shall return zero; otherwise, an error number shall be returned to indicate the error.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_546_05"></a>ERRORS</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>pthread_mutexattr_setprotocol</i>() function shall fail if:</p>
|
|
|
|
<dl compact>
|
|
<dt>[ENOTSUP]</dt>
|
|
|
|
<dd>The value specified by <i>protocol</i> is an unsupported value.</dd>
|
|
</dl>
|
|
|
|
<p>The <i>pthread_mutexattr_getprotocol</i>() and <i>pthread_mutexattr_setprotocol</i>() functions may fail if:</p>
|
|
|
|
<dl compact>
|
|
<dt>[EINVAL]</dt>
|
|
|
|
<dd>The value specified by <i>attr</i> or <i>protocol</i> is invalid.</dd>
|
|
|
|
<dt>[EPERM]</dt>
|
|
|
|
<dd>The caller does not have the privilege to perform the operation.</dd>
|
|
</dl>
|
|
|
|
<p>These functions shall not return an error code of [EINTR].</p>
|
|
</blockquote>
|
|
|
|
<hr>
|
|
<div class="box"><em>The following sections are informative.</em></div>
|
|
|
|
<h4><a name="tag_03_546_06"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_546_07"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_546_08"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_546_09"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_546_10"></a>SEE ALSO</h4>
|
|
|
|
<blockquote>
|
|
<p><a href="pthread_cond_destroy.html"><i>pthread_cond_destroy</i>()</a> , <a href=
|
|
"pthread_create.html"><i>pthread_create</i>()</a> , <a href="pthread_mutex_destroy.html"><i>pthread_mutex_destroy</i>()</a> , the
|
|
Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/pthread.h.html"><i><pthread.h></i></a></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_546_11"></a>CHANGE HISTORY</h4>
|
|
|
|
<blockquote>
|
|
<p>First released in Issue 5. Included for alignment with the POSIX Threads Extension.</p>
|
|
|
|
<p>Marked as part of the Realtime Threads Feature Group.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_546_12"></a>Issue 6</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>pthread_mutexattr_getprotocol</i>() and <i>pthread_mutexattr_setprotocol</i>() functions are marked as part of the
|
|
Threads option and either the Thread Priority Protection or Thread Priority Inheritance options.</p>
|
|
|
|
<p>The [ENOSYS] error condition has been removed as stubs need not be provided if an implementation does not support the Thread
|
|
Priority Protection or Thread Priority Inheritance options.</p>
|
|
|
|
<p>The <b>restrict</b> keyword is added to the <i>pthread_mutexattr_getprotocol</i>() prototype for alignment with the
|
|
ISO/IEC 9899:1999 standard.</p>
|
|
</blockquote>
|
|
|
|
<div class="box"><em>End of informative text.</em></div>
|
|
|
|
<hr>
|
|
<hr size="2" noshade>
|
|
<center><font size="2"><!--footer start-->
|
|
UNIX ® is a registered Trademark of The Open Group.<br>
|
|
POSIX ® is a registered Trademark of The IEEE.<br>
|
|
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
|
|
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
|
|
]</font></center>
|
|
|
|
<!--footer end-->
|
|
<hr size="2" noshade>
|
|
</body>
|
|
</html>
|
|
|