Trait Scheduler

Source
pub trait Scheduler<T = Task>: Sync + Send {
    // Required methods
    fn enqueue(&self, runnable: Arc<T>, flags: EnqueueFlags) -> Option<CpuId>;
    fn local_rq_with(&self, f: &mut dyn FnMut(&dyn LocalRunQueue<T>));
    fn local_mut_rq_with(&self, f: &mut dyn FnMut(&mut dyn LocalRunQueue<T>));
}
Expand description

A per-CPU task scheduler.

Required Methods§

Source

fn enqueue(&self, runnable: Arc<T>, flags: EnqueueFlags) -> Option<CpuId>

Enqueues a runnable task.

Scheduler developers can perform load-balancing or some accounting work here.

If the current of a CPU needs to be preempted, this method returns the id of that CPU.

Source

fn local_rq_with(&self, f: &mut dyn FnMut(&dyn LocalRunQueue<T>))

Gets an immutable access to the local runqueue of the current CPU core.

Source

fn local_mut_rq_with(&self, f: &mut dyn FnMut(&mut dyn LocalRunQueue<T>))

Gets a mutable access to the local runqueue of the current CPU core.

Implementors§