change the priority and scheduling policy of a process
#include <sys/sched.h> int sched_setscheduler( pid_t pid, int policy, struct sched_param *param );
The sched_setscheduler() function changes the priority of process pid (or the current process if pid is zero) to that of the sched_priority member in the sched_param structure passed as param, and the scheduling policy is set to policy.
The policy parameter must be one of:
The sched_priority member in param must lie between the minimum and maximum values defined in <sys/sched.h> .
By default, process priority and scheduling algorithm are inherited from or explicitly set by the parent process. Once running, the child process may change its priority using this function.
The previous scheduling policy. On error, -1 is returned and errno is set.
See qnx_scheduler().
POSIX 1003.4
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | Yes, but modifies errno |
Thread | Yes |
errno, getprio(), qnx_scheduler(), sched_getparam(), sched_getscheduler(), sched_setparam(), sched_yield(), setprio()