xtos_ rt_ set_ scheduler
Calls sched_setscheduler for the calling thread with a Linux policy and static priority.
On this page
Declaration
#include <xtos/rt.h>
int xtos_rt_set_scheduler(int policy, int priority);Parameters
| Parameter | Type | Description |
|---|---|---|
| policy | int | A Linux scheduler policy such as SCHED_OTHER, SCHED_FIFO, or SCHED_RR; the kernel supplies its valid range. |
| priority | int | The policy’s static priority; SCHED_OTHER normally requires 0. It is not a nice value. |
Return value
Returns 0 on success and -1 on failure.
Errors
| errno | Condition |
|---|---|
| EINVAL | The policy is invalid, its priority range cannot be queried, or priority is outside that range. |
| EPERM | The calling thread lacks permission to set the requested real-time policy or priority. |
| system errno | Returns errno from sched_get_priority_* or sched_setscheduler when those calls fail. |
Notes
- Changes only the calling thread; configuring the main thread does not reconfigure existing workers.
- The function does not implement deadline-specific parameters or rollback. Linux permissions and resource limits decide whether the change is allowed.
Example
Source
This reference describes headers and implementation at OpenXTOS commit dd313955ad57542bcd2af8827157d1bbd0cf5e83.