⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pthread_getschedparam.html

📁 posix标准英文,html格式
💻 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-2004 IEEE and 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, 2004 Edition<br>Copyright &copy; 2001-2004 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>REALTIMETHREADS</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 &lt;<a href="../basedefs/pthread.h.html">pthread.h</a>&gt;<br><br> int pthread_getschedparam(pthread_t</tt> <i>thread</i><tt>, int *restrict</tt> <i>policy</i><tt>,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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 schedulingpolicy 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 affectedscheduling parameters are implementation-defined.</p><p>The <i>pthread_getschedparam</i>() function shall retrieve the scheduling policy and scheduling parameters for the thread whosethread ID is given by <i>thread</i> and shall store those values in <i>policy</i> and <i>param</i>, respectively. The priorityvalue 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 temporaryadjustments 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 theSCHED_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 exceptionfor the <i>pthread_setschedparam</i>() function that if the scheduling policy was not SCHED_SPORADIC at the time of the call, it isimplementation-defined whether the function is supported; in other words, the implementation need not allow the application todynamically 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 functionshall 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, anerror 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> isinvalid.</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 thischange. <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 thespecified 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 BaseDefinitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/pthread.h.html"><i>&lt;pthread.h&gt;</i></a>, <a href="../basedefs/sched.h.html"><i>&lt;sched.h&gt;</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 ThreadExecution Scheduling options.</p><p>The [ENOSYS] error condition has been removed as stubs need not be provided if an implementation does not support the ThreadExecution Scheduling option.</p><p>The Open Group Corrigendum U026/2 is applied, correcting the prototype for the <i>pthread_setschedparam</i>() function so thatits second argument is of type <b>int</b>.</p><p>The SCHED_SPORADIC scheduling policy is added for alignment with IEEE&nbsp;Std&nbsp;1003.1d-1999.</p><p>The <b>restrict</b> keyword is added to the <i>pthread_getschedparam</i>() prototype for alignment with theISO/IEC&nbsp;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 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>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -