Trait ostd::task::Scheduler

source ·
pub trait Scheduler: Sync + Send {
    // Required methods
    fn enqueue(&self, task: Arc<Task>);
    fn dequeue(&self) -> Option<Arc<Task>>;
    fn should_preempt(&self, task: &Arc<Task>) -> bool;
}
Expand description

A scheduler for tasks.

An implementation of scheduler can attach scheduler-related information with the TypeMap returned from task.data().

Required Methods§

source

fn enqueue(&self, task: Arc<Task>)

Enqueues a task to the scheduler.

source

fn dequeue(&self) -> Option<Arc<Task>>

Dequeues a task from the scheduler.

source

fn should_preempt(&self, task: &Arc<Task>) -> bool

Tells whether the given task should be preempted by other tasks in the queue.

Implementors§