Trait LocalRunQueue

Source
pub trait LocalRunQueue<T = Task> {
    // Required methods
    fn current(&self) -> Option<&Arc<T>>;
    fn update_current(&mut self, flags: UpdateFlags) -> bool;
    fn pick_next_current(&mut self) -> Option<&Arc<T>>;
    fn dequeue_current(&mut self) -> Option<Arc<T>>;
}
Expand description

The local view of a per-CPU runqueue.

This local view provides the interface for the runqueue of a CPU core to be inspected and manipulated by the code running on this particular CPU core.

Conceptually, a local runqueue consists of two parts: (1) a priority queue of runnable tasks; (2) the current running task. The exact definition of “priority” is left for the concrete implementation to decide.

Required Methods§

Source

fn current(&self) -> Option<&Arc<T>>

Gets the current runnable task.

Source

fn update_current(&mut self, flags: UpdateFlags) -> bool

Updates the current runnable task’s scheduling statistics and potentially its position in the queue.

If the current runnable task needs to be preempted, the method returns true.

Source

fn pick_next_current(&mut self) -> Option<&Arc<T>>

Picks the next current runnable task.

This method returns the chosen next current runnable task. If there is no candidate for next current runnable task, this method returns None.

Source

fn dequeue_current(&mut self) -> Option<Arc<T>>

Removes the current runnable task from runqueue.

This method returns the current runnable task. If there is no current runnable task, this method returns None.

Implementors§