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 mut_local_rq_with(&self, f: &mut dyn FnMut(&mut dyn LocalRunQueue<T>));
}
Expand description

A SMP-aware task scheduler.

Required Methods§

Source

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

Enqueues a runnable task.

The scheduler implementer can perform load-balancing or some time accounting work here.

The newly-enqueued task may have a higher priority than the currently running one on a CPU and thus should preempt the latter. In this case, 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.

Source

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

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

Implementors§