pub trait Scheduler {
// Required methods
fn next_to_run(&self) -> Option<Box<Thread>>;
fn push_to_queue(&self, th: Box<Thread>);
fn timer_tick(&self);
}
Expand description
Common features of thread scheduler.
Required Methods§
sourcefn next_to_run(&self) -> Option<Box<Thread>>
fn next_to_run(&self) -> Option<Box<Thread>>
Peek a next thread to run.
If there is no thread to run, returns None.
sourcefn push_to_queue(&self, th: Box<Thread>)
fn push_to_queue(&self, th: Box<Thread>)
Push a thread th
into scheduling queue.
sourcefn timer_tick(&self)
fn timer_tick(&self)
Called on every timer interrupt (1ms).
Implementations§
source§impl dyn Scheduler
impl dyn Scheduler
sourcepub fn reschedule(&self)
pub fn reschedule(&self)
Reschedule.