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§
Sourcefn enqueue(&self, runnable: Arc<T>, flags: EnqueueFlags) -> Option<CpuId>
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.
Sourcefn local_rq_with(&self, f: &mut dyn FnMut(&dyn LocalRunQueue<T>))
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.
Sourcefn local_mut_rq_with(&self, f: &mut dyn FnMut(&mut dyn LocalRunQueue<T>))
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.