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

📄 schedpxlib.html

📁 Vxworks API操作系统和驱动程序设计API。压缩的HTML文件
💻 HTML
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/schedPxLib.html - generated by refgen from schedPxLib.c --> <title> schedPxLib </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.htm"><i>VxWorks API Reference :  OS Libraries</i></a></p></blockquote><h1>schedPxLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>schedPxLib</strong> - scheduling library (POSIX) </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><a href="./schedPxLib.html#sched_setparam">sched_setparam</a>(&nbsp;)</b>  -  set a task's priority (POSIX)<br><b><a href="./schedPxLib.html#sched_getparam">sched_getparam</a>(&nbsp;)</b>  -  get the scheduling parameters for a specified task (POSIX)<br><b><a href="./schedPxLib.html#sched_setscheduler">sched_setscheduler</a>(&nbsp;)</b>  -  set scheduling policy and scheduling parameters (POSIX)<br><b><a href="./schedPxLib.html#sched_getscheduler">sched_getscheduler</a>(&nbsp;)</b>  -  get the current scheduling policy (POSIX)<br><b><a href="./schedPxLib.html#sched_yield">sched_yield</a>(&nbsp;)</b>  -  relinquish the CPU (POSIX)<br><b><a href="./schedPxLib.html#sched_get_priority_max">sched_get_priority_max</a>(&nbsp;)</b>  -  get the maximum priority (POSIX)<br><b><a href="./schedPxLib.html#sched_get_priority_min">sched_get_priority_min</a>(&nbsp;)</b>  -  get the minimum priority (POSIX)<br><b><a href="./schedPxLib.html#sched_rr_get_interval">sched_rr_get_interval</a>(&nbsp;)</b>  -  get the current time slice (POSIX)<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p><p>This library provides POSIX-compliance scheduling routines.  The routinesin this library allow the user to get and set priorities and schedulingschemes, get maximum and minimum priority values, and get the time sliceif round-robin scheduling is enabled.<p>The POSIX standard specifies a priority numbering scheme in whichhigher priorities are indicated by larger numbers.  The VxWorks nativenumbering scheme is the reverse of this, with higher priorities indicatedby smaller numbers.  For example, in the VxWorks native priority numberingscheme, the highest priority task has a priority of 0.<p>In VxWorks, POSIX scheduling interfaces are implemented using the POSIXpriority numbering scheme.  This means that the priority numbers used bythis library <i>do not</i> match those reported and used in all the otherVxWorks components.  It is possible to change the priority numberingscheme used by this library by setting the global variable<b>posixPriorityNumbering</b>.  If this variable is set to FALSE, the VxWorksnative numbering scheme (small number = high priority) is used, andpriority numbers used by this library will match those used by the otherportions of VxWorks.<p>The routines in this library are compliant with POSIX 1003.1b.  Inparticular, task priorities are set and reported through the structure<b>sched_setparam</b>, which has a single member:<p><pre>struct sched_param              /* Scheduling parameter structure */    {    int sched_priority;         /* scheduling priority */    };</pre>POSIX 1003.1b specifies this indirection to permit future extensionsthrough the same calling interface.  For example, because<b><a href="./schedPxLib.html#sched_setparam">sched_setparam</a>(&nbsp;)</b> takes this structure as an argument (rather thanusing the priority value directly) its type signature need not changeif future schedulers require other parameters.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>sched.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p>POSIX 1003.1b document, <b><a href="./taskLib.html#top">taskLib</a></b><hr><a name="sched_setparam"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>sched_setparam(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>sched_setparam(&nbsp;)</strong> - set a task's priority (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int sched_setparam    (    pid_t                      tid,  /* task ID */    const struct sched_param * param /* scheduling parameter */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine sets the priority of a specified task, <i>tid</i>.  If <i>tid</i> is 0,it sets the priority of the calling task.  Valid priority numbers are 0through 255.<p>The <i>param</i> argument is a structure whose member <b>sched_priority</b> isthe integer priority value.  For example, the following program fragmentsets the calling task's priority to 13 using POSIX interfaces:<p><pre>#include "sched.h" ...struct sched_param AppSchedPrio; ...AppSchedPrio.sched_priority = 13;if ( sched_setparam (0, &amp;AppSchedPrio) != OK )    {    ... /* recovery attempt or abort message */    } ...</pre></blockquote><h4>NOTE</h4><blockquote><p>If the global variable <b>posixPriorityNumbering</b> is FALSE, the VxWorksnative priority numbering scheme is used, in which higher priorities areindicated by smaller numbers.  This is different than the priority numbering scheme specified by POSIX, in which higher priorities are indicated bylarger numbers.<p></blockquote><h4>RETURNS</h4><blockquote><p>0 (OK) if successful, or -1 (ERROR) on error.<p></blockquote><h4>ERRNO</h4><blockquote><p><p>&nbsp;EINVAL<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;scheduling&nbsp;priority&nbsp;is&nbsp;outside&nbsp;valid&nbsp;range.<br>&nbsp;ESRCH<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;task&nbsp;ID&nbsp;is&nbsp;invalid.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./schedPxLib.html#top">schedPxLib</a></b><hr><a name="sched_getparam"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>sched_getparam(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>sched_getparam(&nbsp;)</strong> - get the scheduling parameters for a specified task (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int sched_getparam    (    pid_t                tid,  /* task ID */    struct sched_param * param /* scheduling param to store priority */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine gets the scheduling priority for a specified task, <i>tid</i>.If <i>tid</i> is 0, it gets the priority of the calling task.  The task'spriority is copied to the <b>sched_param</b> structure pointed to by <i>param</i>.<p></blockquote><h4>NOTE</h4><blockquote><p>If the global variable <b>posixPriorityNumbering</b> is FALSE, the VxWorksnative priority numbering scheme is used, in which higher priorities areindicated by smaller numbers.  This is different than the priority numbering scheme specified by POSIX, in which higher priorities are indicated bylarger numbers.<p></blockquote><h4>RETURNS</h4><blockquote><p>0 (OK) if successful, or -1 (ERROR) on error.<p></blockquote><h4>ERRNO</h4><blockquote><p><p>&nbsp;ESRCH<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;invalid&nbsp;task&nbsp;ID.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./schedPxLib.html#top">schedPxLib</a></b><hr><a name="sched_setscheduler"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>sched_setscheduler(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>sched_setscheduler(&nbsp;)</strong> - set scheduling policy and scheduling parameters (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int sched_setscheduler    (    pid_t                      tid,    /* task ID */    int                        policy, /* scheduling policy requested */    const struct sched_param * param   /* scheduling parameters requested */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine sets the scheduling policy and scheduling parameters for aspecified task, <i>tid</i>.  If <i>tid</i> is 0, it sets the scheduling policy andscheduling parameters for the calling task.<p>Because VxWorks does not set scheduling policies (e.g., round-robin scheduling) on a task-by-task basis, setting a scheduling policy that conflicts with the current system policy simply fails and errno is set to EINVAL.  If the requested scheduling policy is the same as the current system policy, then this routine acts just like <b><a href="./schedPxLib.html#sched_setparam">sched_setparam</a>(&nbsp;)</b>.<p></blockquote><h4>NOTE</h4><blockquote><p>If the global variable <b>posixPriorityNumbering</b> is FALSE, the VxWorksnative priority numbering scheme is used, in which higher priorities areindicated by smaller numbers.  This is different than the priority numbering scheme specified by POSIX, in which higher priorities are indicated bylarger numbers.<p></blockquote><h4>RETURNS</h4><blockquote><p>The previous scheduling policy (<b>SCHED_FIFO</b> or <b>SCHED_RR</b>), or -1 (ERROR) on error.<p></blockquote><h4>ERRNO</h4><blockquote><p><p>&nbsp;EINVAL<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;scheduling&nbsp;priority&nbsp;is&nbsp;outside&nbsp;valid&nbsp;range,&nbsp;or&nbsp;it&nbsp;is&nbsp;impossible&nbsp;to&nbsp;set<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;specified&nbsp;scheduling&nbsp;policy.<br>&nbsp;ESRCH<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;invalid&nbsp;task&nbsp;ID.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./schedPxLib.html#top">schedPxLib</a></b><hr><a name="sched_getscheduler"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>sched_getscheduler(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>sched_getscheduler(&nbsp;)</strong> - get the current scheduling policy (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int sched_getscheduler    (    pid_t tid                 /* task ID */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine returns the currents scheduling policy (i.e., <b>SCHED_FIFO</b> or <b>SCHED_RR</b>).  <p></blockquote><h4>RETURNS</h4><blockquote><p>Current scheduling policy (<b>SCHED_FIFO</b> or <b>SCHED_RR</b>), or -1 (ERROR) on error.<p></blockquote><h4>ERRNO</h4><blockquote><p><p>&nbsp;ESRCH<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;invalid&nbsp;task&nbsp;ID.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./schedPxLib.html#top">schedPxLib</a></b><hr><a name="sched_yield"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>sched_yield(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>sched_yield(&nbsp;)</strong> - relinquish the CPU (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int sched_yield (void)</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine forces the running task to give up the CPU.<p></blockquote><h4>RETURNS</h4><blockquote><p>0 (OK) if successful, or -1 (ERROR) on error.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./schedPxLib.html#top">schedPxLib</a></b><hr><a name="sched_get_priority_max"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>sched_get_priority_max(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>sched_get_priority_max(&nbsp;)</strong> - get the maximum priority (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int sched_get_priority_max    (    int policy                /* scheduling policy */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine returns the value of the highest possible task priority for a specified scheduling policy (<b>SCHED_FIFO</b> or <b>SCHED_RR</b>).<p></blockquote><h4>NOTE</h4><blockquote><p>If the global variable <b>posixPriorityNumbering</b> is FALSE, the VxWorksnative priority numbering scheme is used, in which higher priorities areindicated by smaller numbers.  This is different than the priority numbering scheme specified by POSIX, in which higher priorities are indicated bylarger numbers.<p></blockquote><h4>RETURNS</h4><blockquote><p>Maximum priority value, or -1 (ERROR) on error.<p></blockquote><h4>ERRNO</h4><blockquote><p><p>&nbsp;EINVAL<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;invalid&nbsp;scheduling&nbsp;policy.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./schedPxLib.html#top">schedPxLib</a></b><hr><a name="sched_get_priority_min"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>sched_get_priority_min(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>sched_get_priority_min(&nbsp;)</strong> - get the minimum priority (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int sched_get_priority_min    (    int policy                /* scheduling policy */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine returns the value of the lowest possible task priority for a specified scheduling policy (<b>SCHED_FIFO</b> or <b>SCHED_RR</b>).<p></blockquote><h4>NOTE</h4><blockquote><p>If the global variable <b>posixPriorityNumbering</b> is FALSE, the VxWorksnative priority numbering scheme is used, in which higher priorities areindicated by smaller numbers.  This is different than the priority numbering scheme specified by POSIX, in which higher priorities are indicated bylarger numbers.<p></blockquote><h4>RETURNS</h4><blockquote><p>Minimum priority value, or -1 (ERROR) on error.<p></blockquote><h4>ERRNO</h4><blockquote><p><p>&nbsp;EINVAL<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;invalid&nbsp;scheduling&nbsp;policy.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./schedPxLib.html#top">schedPxLib</a></b><hr><a name="sched_rr_get_interval"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>sched_rr_get_interval(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>sched_rr_get_interval(&nbsp;)</strong> - get the current time slice (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int sched_rr_get_interval    (    pid_t             tid,     /* task ID */    struct timespec * interval /* struct to store time slice */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine sets <i>interval</i> to the current time slice period if round-robinscheduling is currently enabled. <p></blockquote><h4>RETURNS</h4><blockquote><p>0 (OK) if successful, -1 (ERROR) on error.<p></blockquote><h4>ERRNO</h4><blockquote><p><p>&nbsp;EINVAL<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;round-robin&nbsp;scheduling&nbsp;is&nbsp;not&nbsp;currently&nbsp;enabled.<br>&nbsp;ESRCH<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;invalid&nbsp;task&nbsp;ID.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./schedPxLib.html#top">schedPxLib</a></b></body></html>

⌨️ 快捷键说明

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