Files
oldlinux-files/Ref-docs/POSIX/susv3/functions/pthread_setschedprio.html
2024-02-19 00:21:47 -05:00

151 lines
5.7 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_setschedprio</title>
</head>
<body bgcolor="white">
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
</script>
<basefont size="3"> <a name="pthread_setschedprio"></a> <a name="tag_03_571"></a><!-- pthread_setschedprio -->
<!--header start-->
<center><font size="2">The Open Group Base Specifications Issue 6<br>
IEEE Std 1003.1-2001<br>
Copyright &copy; 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
<!--header end-->
<hr size="2" noshade>
<h4><a name="tag_03_571_01"></a>NAME</h4>
<blockquote>pthread_setschedprio - dynamic thread scheduling parameters access (<b>REALTIME THREADS</b>)</blockquote>
<h4><a name="tag_03_571_02"></a>SYNOPSIS</h4>
<blockquote class="synopsis">
<div class="box"><code><tt><sup>[<a href="javascript:open_code('THR TPS')">THR TPS</a>]</sup> <img src="../images/opt-start.gif" alt=
"[Option Start]" border="0"> #include &lt;<a href="../basedefs/pthread.h.html">pthread.h</a>&gt;<br>
<br>
int pthread_setschedprio(pthread_t</tt> <i>thread</i><tt>, int</tt> <i>prio</i><tt>); <img src="../images/opt-end.gif" alt=
"[Option End]" border="0"></tt></code></div>
<tt><br>
</tt></blockquote>
<h4><a name="tag_03_571_03"></a>DESCRIPTION</h4>
<blockquote>
<p>The <i>pthread_setschedprio</i>() function shall set the scheduling priority for the thread whose thread ID is given by
<i>thread</i> to the value given by <i>prio</i>. See <a href="xsh_chap02_08.html#tag_02_08_04_01"><i>Scheduling Policies</i></a>
for a description on how this function call affects the ordering of the thread in the thread list for its new priority.</p>
<p>If the <i>pthread_setschedprio</i>() function fails, the scheduling priority of the target thread shall not be changed.</p>
</blockquote>
<h4><a name="tag_03_571_04"></a>RETURN VALUE</h4>
<blockquote>
<p>If successful, the <i>pthread_setschedprio</i>() function shall return zero; otherwise, an error number shall be returned to
indicate the error.</p>
</blockquote>
<h4><a name="tag_03_571_05"></a>ERRORS</h4>
<blockquote>
<p>The <i>pthread_setschedprio</i>() function may fail if:</p>
<dl compact>
<dt>[EINVAL]</dt>
<dd>The value of <i>prio</i> is invalid for the scheduling policy of the specified thread.</dd>
<dt>[ENOTSUP]</dt>
<dd>An attempt was made to set the priority to an unsupported value.</dd>
<dt>[EPERM]</dt>
<dd>The caller does not have the appropriate permission to set the scheduling policy of the specified thread.</dd>
<dt>[EPERM]</dt>
<dd>The implementation does not allow the application to modify the priority to the value specified.</dd>
<dt>[ESRCH]</dt>
<dd>The value specified by <i>thread</i> does not refer to an existing thread.</dd>
</dl>
<p>The <i>pthread_setschedprio</i>() function 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_571_06"></a>EXAMPLES</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_571_07"></a>APPLICATION USAGE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_571_08"></a>RATIONALE</h4>
<blockquote>
<p>The <i>pthread_setschedprio</i>() function provides a way for an application to temporarily raise its priority and then lower it
again, without having the undesired side effect of yielding to other threads of the same priority. This is necessary if the
application is to implement its own strategies for bounding priority inversion, such as priority inheritance or priority ceilings.
This capability is especially important if the implementation does not support the Thread Priority Protection or Thread Priority
Inheritance options, but even if those options are supported it is needed if the application is to bound priority inheritance for
other resources, such as semaphores.</p>
<p>The standard developers considered that while it might be preferable conceptually to solve this problem by modifying the
specification of <a href="../functions/pthread_setschedparam.html"><i>pthread_setschedparam</i>()</a>, it was too late to make such
a change, as there may be implementations that would need to be changed. Therefore, this new function was introduced.</p>
</blockquote>
<h4><a name="tag_03_571_09"></a>FUTURE DIRECTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_571_10"></a>SEE ALSO</h4>
<blockquote>
<p><a href="xsh_chap02_08.html#tag_02_08_04_01"><i>Scheduling Policies</i></a> , <a href=
"pthread_getschedparam.html"><i>pthread_getschedparam</i>()</a> , the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a
href="../basedefs/pthread.h.html"><i>&lt;pthread.h&gt;</i></a></p>
</blockquote>
<h4><a name="tag_03_571_11"></a>CHANGE HISTORY</h4>
<blockquote>
<p>First released in Issue 6. Included as a response to IEEE PASC Interpretation 1003.1 #96.</p>
</blockquote>
<div class="box"><em>End of informative text.</em></div>
<hr>
<hr size="2" noshade>
<center><font size="2"><!--footer start-->
UNIX &reg; is a registered Trademark of The Open Group.<br>
POSIX &reg; 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>