XTOS / OPEN SOURCE REAL-TIME SYSTEMOPEN SOURCE · VERSION 0.9.0 · BUILD FROM SOURCE
libxtos-rtxtos_rt_set_scheduler

xtos_rt_set_scheduler

Calls sched_setscheduler for the calling thread with a Linux policy and static priority.

On this page

Declaration

c
#include <xtos/rt.h>

int xtos_rt_set_scheduler(int policy, int priority);

Parameters

ParameterTypeDescription
policyintA Linux scheduler policy such as SCHED_OTHER, SCHED_FIFO, or SCHED_RR; the kernel supplies its valid range.
priorityintThe 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

errnoCondition
EINVALThe policy is invalid, its priority range cannot be queried, or priority is outside that range.
EPERMThe calling thread lacks permission to set the requested real-time policy or priority.
system errnoReturns 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.