OSSchedRoundRobinYield
Description
OSSchedRoundRobinYield() is used to voluntarily give up a task’s time slot, assuming that there are other tasks running at the same priority.
Files
os.h/os_core.c
Prototype
void OSSchedRoundRobinYield (OS_ERR *p_err)Arguments
p_err
is a pointer to a variable used to hold an error code:
OS_ERR_NONE
If the call was successful.
OS_ERR_ROUND_ROBIN_1
If there is only one task at the current priority level that is ready-to-run.
OS_ERR_ROUND_ROBIN_DISABLED
If round-robin scheduling has not been enabled. See OSSchedRoundRobinCfg() to enable or disable.
OS_ERR_SCHED_LOCKED
If the scheduler is locked and µC/OS-III cannot switch tasks.
OS_ERR_YIELD_ISR
If OS_CFG_CALLED_FROM_ISR_CHK_EN set to DEF_ENABLED in os_cfg.h: if calling this function from an ISR.
Returned Value
None
Required Configuration
OS_CFG_SCHED_ROUND_ROBIN_EN must be enabled in os_cfg.h. Refer to µC-OS-III Configuration Manual.
Callers
Application.
Notes/Warnings
None
Example Usage
OSSchedRoundRobinYield() example usage
void Task (void *p_arg)
{
OS_ERR err;
(void)&p_arg;
while (DEF_ON) {
:
:
OSSchedRoundRobinYield(&err); /* Give up the CPU to the next task at same priority */
/* Check "err" */
:
:
}
}