Struct scheduler::CFScheduler

source ·
pub struct CFScheduler<T> { /* private fields */ }
Expand description

A simple Completely Fair Scheduler (CFS).

Implementations§

source§

impl<T> CFScheduler<T>

source

pub const fn new() -> Self

Creates a new empty CFScheduler.

source

pub fn scheduler_name() -> &'static str

get the name of scheduler

Trait Implementations§

source§

impl<T> BaseScheduler for CFScheduler<T>

§

type SchedItem = Arc<CFSTask<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 CFScheduler<T>
where T: RefUnwindSafe,

§

impl<T> Send for CFScheduler<T>
where T: Sync + Send,

§

impl<T> Sync for CFScheduler<T>
where T: Sync + Send,

§

impl<T> Unpin for CFScheduler<T>

§

impl<T> UnwindSafe for CFScheduler<T>
where T: RefUnwindSafe,

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.