sched_yield(3) — Subroutines
NAME
sched_yield − Yield execution to another process (P1003.1b)
SYNOPSIS
#include <sched.h>
#include <unistd.h>
int sched_yield (
void);
PARAMETERS
void The sched_yield function takes no arguments.
DESCRIPTION
The sched_yield function yields execution to another process. It is useful when an application running under the SCHED_FIFO scheduling policy needs to allow another process at the same priority to run. The process that was interrupted by sched_yield goes to the end of the queue for its priority. The sched_yield function takes no arguments.
If no other process is runnable at the priority of the caller, the caller continues to run.
Note that processes with higher priority are allowed to preempt the running process, so the sched_yield function has no effect on the scheduling of higher- or lower-priority processes.
No special privileges are needed to use the sched_yield function.
RETURN VALUES
On a successful call to the sched_yield function, a value of 0 is returned. On an unsuccessful call, a value of −1 is returned and errno is set to indicate that an error occurred.
ERRORS
The sched_yield function fails under the following condition:
[ENOSYS] The function sched_yield is not supported by this implementation.
RELATED INFORMATION
Functions: sched_getscheduler(3), sched_setscheduler(3)