zephyr::raw

Function k_sched_time_slice_set

source
pub unsafe extern "C" fn k_sched_time_slice_set(slice: i32, prio: i32)
Expand description

@brief Set time-slicing period and scope.

This routine specifies how the scheduler will perform time slicing of preemptible threads.

To enable time slicing, @a slice must be non-zero. The scheduler ensures that no thread runs for more than the specified time limit before other threads of that priority are given a chance to execute. Any thread whose priority is higher than @a prio is exempted, and may execute as long as desired without being preempted due to time slicing.

Time slicing only limits the maximum amount of time a thread may continuously execute. Once the scheduler selects a thread for execution, there is no minimum guaranteed time the thread will execute before threads of greater or equal priority are scheduled.

When the current thread is the only one of that priority eligible for execution, this routine has no effect; the thread is immediately rescheduled after the slice period expires.

To disable timeslicing, set both @a slice and @a prio to zero.

@param slice Maximum time slice length (in milliseconds). @param prio Highest thread priority level eligible for time slicing.