211 lines
9.2 KiB
HTML
211 lines
9.2 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_getschedparam</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
|
</script>
|
|
|
|
<basefont size="3"> <a name="pthread_getschedparam"></a> <a name="tag_03_531"></a><!-- pthread_getschedparam -->
|
|
<!--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_531_01"></a>NAME</h4>
|
|
|
|
<blockquote>pthread_getschedparam, pthread_setschedparam - dynamic thread scheduling parameters access (<b>REALTIME
|
|
THREADS</b>)</blockquote>
|
|
|
|
<h4><a name="tag_03_531_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 <<a href="../basedefs/pthread.h.html">pthread.h</a>><br>
|
|
<br>
|
|
int pthread_getschedparam(pthread_t</tt> <i>thread</i><tt>, int *restrict</tt> <i>policy</i><tt>,<br>
|
|
struct sched_param *restrict</tt> <i>param</i><tt>);<br>
|
|
int pthread_setschedparam(pthread_t</tt> <i>thread</i><tt>, int</tt> <i>policy</i><tt>,<br>
|
|
const struct sched_param *</tt><i>param</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_531_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>pthread_getschedparam</i>() and <i>pthread_setschedparam</i>() functions shall, respectively, get and set the scheduling
|
|
policy and parameters of individual threads within a multi-threaded process to be retrieved and set. For SCHED_FIFO and SCHED_RR,
|
|
the only required member of the <b>sched_param</b> structure is the priority <i>sched_priority</i>. For SCHED_OTHER, the affected
|
|
scheduling parameters are implementation-defined.</p>
|
|
|
|
<p>The <i>pthread_getschedparam</i>() function shall retrieve the scheduling policy and scheduling parameters for the thread whose
|
|
thread ID is given by <i>thread</i> and shall store those values in <i>policy</i> and <i>param</i>, respectively. The priority
|
|
value returned from <i>pthread_getschedparam</i>() shall be the value specified by the most recent <i>pthread_setschedparam</i>(),
|
|
<a href="../functions/pthread_setschedprio.html"><i>pthread_setschedprio</i>()</a>, or <a href=
|
|
"../functions/pthread_create.html"><i>pthread_create</i>()</a> call affecting the target thread. It shall not reflect any temporary
|
|
adjustments to its priority as a result of any priority inheritance or ceiling functions. The <i>pthread_setschedparam</i>()
|
|
function shall set the scheduling policy and associated scheduling parameters for the thread whose thread ID is given by
|
|
<i>thread</i> to the policy and associated parameters provided in <i>policy</i> and <i>param</i>, respectively.</p>
|
|
|
|
<p>The <i>policy</i> parameter may have the value SCHED_OTHER, SCHED_FIFO, or SCHED_RR. The scheduling parameters for the
|
|
SCHED_OTHER policy are implementation-defined. The SCHED_FIFO and SCHED_RR policies shall have a single scheduling parameter,
|
|
<i>priority</i>.</p>
|
|
|
|
<p><sup>[<a href="javascript:open_code('TSP')">TSP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
If _POSIX_THREAD_SPORADIC_SERVER is defined, then the <i>policy</i> argument may have the value SCHED_SPORADIC, with the exception
|
|
for the <i>pthread_setschedparam</i>() function that if the scheduling policy was not SCHED_SPORADIC at the time of the call, it is
|
|
implementation-defined whether the function is supported; in other words, the implementation need not allow the application to
|
|
dynamically change the scheduling policy to SCHED_SPORADIC. The sporadic server scheduling policy has the associated parameters
|
|
<i>sched_ss_low_priority</i>, <i>sched_ss_repl_period</i>, <i>sched_ss_init_budget</i>, <i>sched_priority</i>, and
|
|
<i>sched_ss_max_repl</i>. The specified <i>sched_ss_repl_period</i> shall be greater than or equal to the specified
|
|
<i>sched_ss_init_budget</i> for the function to succeed; if it is not, then the function shall fail. The value of
|
|
<i>sched_ss_max_repl</i> shall be within the inclusive range [1, {SS_REPL_MAX}] for the function to succeed; if not, the function
|
|
shall fail. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
|
|
|
|
<p>If the <i>pthread_setschedparam</i>() function fails, the scheduling parameters shall not be changed for the target thread.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_531_04"></a>RETURN VALUE</h4>
|
|
|
|
<blockquote>
|
|
<p>If successful, the <i>pthread_getschedparam</i>() and <i>pthread_setschedparam</i>() functions shall return zero; otherwise, an
|
|
error number shall be returned to indicate the error.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_531_05"></a>ERRORS</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>pthread_getschedparam</i>() function may fail if:</p>
|
|
|
|
<dl compact>
|
|
<dt>[ESRCH]</dt>
|
|
|
|
<dd>The value specified by <i>thread</i> does not refer to an existing thread.</dd>
|
|
</dl>
|
|
|
|
<p>The <i>pthread_setschedparam</i>() function may fail if:</p>
|
|
|
|
<dl compact>
|
|
<dt>[EINVAL]</dt>
|
|
|
|
<dd>The value specified by <i>policy</i> or one of the scheduling parameters associated with the scheduling policy <i>policy</i> is
|
|
invalid.</dd>
|
|
|
|
<dt>[ENOTSUP]</dt>
|
|
|
|
<dd>An attempt was made to set the policy or scheduling parameters to an unsupported value.</dd>
|
|
|
|
<dt>[ENOTSUP]</dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('TSP')">TSP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
An attempt was made to dynamically change the scheduling policy to SCHED_SPORADIC, and the implementation does not support this
|
|
change. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd>
|
|
|
|
<dt>[EPERM]</dt>
|
|
|
|
<dd>The caller does not have the appropriate permission to set either the scheduling parameters or the scheduling policy of the
|
|
specified thread.</dd>
|
|
|
|
<dt>[EPERM]</dt>
|
|
|
|
<dd>The implementation does not allow the application to modify one of the parameters to the value specified.</dd>
|
|
|
|
<dt>[ESRCH]</dt>
|
|
|
|
<dd>The value specified by <i>thread</i> does not refer to a existing thread.</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_531_06"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_531_07"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_531_08"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_531_09"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_531_10"></a>SEE ALSO</h4>
|
|
|
|
<blockquote>
|
|
<p><a href="pthread_setschedprio.html"><i>pthread_setschedprio</i>()</a> , <a href=
|
|
"sched_getparam.html"><i>sched_getparam</i>()</a> , <a href="sched_getscheduler.html"><i>sched_getscheduler</i>()</a> , the Base
|
|
Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/pthread.h.html"><i><pthread.h></i></a>, <a href=
|
|
"../basedefs/sched.h.html"><i><sched.h></i></a></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_531_11"></a>CHANGE HISTORY</h4>
|
|
|
|
<blockquote>
|
|
<p>First released in Issue 5. Included for alignment with the POSIX Threads Extension.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_531_12"></a>Issue 6</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>pthread_getschedparam</i>() and <i>pthread_setschedparam</i>() functions are marked as part of the Threads and Thread
|
|
Execution Scheduling options.</p>
|
|
|
|
<p>The [ENOSYS] error condition has been removed as stubs need not be provided if an implementation does not support the Thread
|
|
Execution Scheduling option.</p>
|
|
|
|
<p>The Open Group Corrigendum U026/2 is applied, correcting the prototype for the <i>pthread_setschedparam</i>() function so that
|
|
its second argument is of type <b>int</b>.</p>
|
|
|
|
<p>The SCHED_SPORADIC scheduling policy is added for alignment with IEEE Std 1003.1d-1999.</p>
|
|
|
|
<p>The <b>restrict</b> keyword is added to the <i>pthread_getschedparam</i>() prototype for alignment with the
|
|
ISO/IEC 9899:1999 standard.</p>
|
|
|
|
<p>The Open Group Corrigendum U047/1 is applied.</p>
|
|
|
|
<p>IEEE PASC Interpretation 1003.1 #96 is applied, noting that priority values can also be set by a call to the <a href=
|
|
"../functions/pthread_setschedprio.html"><i>pthread_setschedprio</i>()</a> function.</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>
|
|
|