Struct scheduler::FifoScheduler
source · pub struct FifoScheduler<T> { /* private fields */ }
Expand description
A simple FIFO (First-In-First-Out) cooperative scheduler.
When a task is added to the scheduler, it’s placed at the end of the ready queue. When picking the next task to run, the head of the ready queue is taken.
As it’s a cooperative scheduler, it does nothing when the timer tick occurs.
It internally uses a linked list as the ready queue.
Implementations§
source§impl<T> FifoScheduler<T>
impl<T> FifoScheduler<T>
sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a new empty FifoScheduler
.
sourcepub fn scheduler_name() -> &'static str
pub fn scheduler_name() -> &'static str
get the name of scheduler
Trait Implementations§
source§impl<T> BaseScheduler for FifoScheduler<T>
impl<T> BaseScheduler for FifoScheduler<T>
source§fn remove_task(&mut self, task: &Self::SchedItem) -> Option<Self::SchedItem>
fn remove_task(&mut self, task: &Self::SchedItem) -> Option<Self::SchedItem>
Removes a task by its reference from the scheduler. Returns the owned
removed task with ownership if it exists. Read more
source§fn pick_next_task(&mut self) -> Option<Self::SchedItem>
fn pick_next_task(&mut self) -> Option<Self::SchedItem>
Picks the next task to run, it will be removed from the scheduler.
Returns
None
if there is not runnable task.source§fn put_prev_task(&mut self, prev: Self::SchedItem, _preempt: bool)
fn put_prev_task(&mut self, prev: Self::SchedItem, _preempt: bool)
Puts the previous task back to the scheduler. The previous task is
usually placed at the end of the ready queue, making it less likely
to be re-scheduled. Read more
Auto Trait Implementations§
impl<T> !RefUnwindSafe for FifoScheduler<T>
impl<T> Send for FifoScheduler<T>where
T: Send,
impl<T> Sync for FifoScheduler<T>where
T: Sync,
impl<T> Unpin for FifoScheduler<T>
impl<T> !UnwindSafe for FifoScheduler<T>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more