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§
sourcefn should_preempt(&self, task: &Arc<Task>) -> bool
fn should_preempt(&self, task: &Arc<Task>) -> bool
Tells whether the given task should be preempted by other tasks in the queue.