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>

source

pub const fn new() -> Self

Creates a new empty FifoScheduler.

source

pub fn scheduler_name() -> &'static str

get the name of scheduler

Trait Implementations§

source§

impl<T> BaseScheduler for FifoScheduler<T>

§

type SchedItem = Arc<FifoTask<T>>

Type of scheduled entities. Often a task struct.
source§

fn init(&mut self)

Initializes the scheduler.
source§

fn add_task(&mut self, task: Self::SchedItem)

Adds a task to the scheduler.
source§

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>

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)

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
source§

fn task_tick(&mut self, _current: &Self::SchedItem) -> bool

Advances the scheduler state at each timer tick. Returns true if re-scheduling is required. Read more
source§

fn set_priority(&mut self, _task: &Self::SchedItem, _prio: isize) -> bool

set priority for a task

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.