Sets kernel thread scheduling parameters.
Item | Description |
---|---|
tid | Specifies the kernel thread. |
priority | Specifies the priority. It must be in the range from 0 to PRI_LOW; 0 is the most favored priority. |
policy | Specifies the scheduling policy.
It must have one of the
following values:
|
The thread_setsched subroutine sets the scheduling parameters for a kernel thread. This includes both the priority and the scheduling policy, which are specified in the priority and policy parameters. The calling and the target thread must be in the same process.
When setting the scheduling policy to SCHED_OTHER, the system chooses the priority; the priority parameter is ignored. The only way to influence the priority of a thread using the default scheduling policy is to change the process nice value.
The calling thread must belong to a process with root authority to change the scheduling policy of a thread to either SCHED_FIFO, SCHED_FIFO2, SCHED_FIFO3, or SCHED_RR.
The thread_setsched kernel service can be called from the process environment only.
Upon successful completion, 0 is returned. Otherwise, -1 is returned, and the error code can be checked by calling the getuerror kernel service.
Item | Description |
---|---|
EINVAL | The priority or policy parameters are not valid. |
EPERM | The calling kernel thread does not have sufficient privilege to perform the operation. |
ESRCH | The kernel thread tid does not exist. |