Skip to main content Skip to main content
Pigweed's logo Pigweed
code_xml
  1. Home
  2. Reference
  3. Rust
  4. pw_kernel
  5. kernel
  6. SchedulerState

SchedulerState

Struct SchedulerState 

Source
pub struct SchedulerState<K: Kernel> {
    pub(crate) kernel_process: UnsafeCell<Process<K>>,
    pub(super) current_thread: Option<ForeignBox<Thread<K>>>,
    pub(super) current_arch_thread_state: *mut K::ThreadState,
    pub(super) process_list: ForeignList<Process<K>, ProcessListAdapter<K>>,
    pub(super) algorithm: GlobalQueueScheduler<K>,
    pub(super) termination_queue: ForeignList<Thread<K>, ThreadListAdapter<K>>,
}

Fields§

§kernel_process: UnsafeCell<Process<K>>§current_thread: Option<ForeignBox<Thread<K>>>§current_arch_thread_state: *mut K::ThreadState§process_list: ForeignList<Process<K>, ProcessListAdapter<K>>§algorithm: GlobalQueueScheduler<K>

The algorithm used for choosing the next thread to run.

§termination_queue: ForeignList<Thread<K>, ThreadListAdapter<K>>

Implementations§

Source§

impl<K: Kernel> SchedulerState<K>

Source

pub const fn new() -> Self

Source

fn reschedule_current_thread( &mut self, reason: RescheduleReason, ) -> (usize, State)

Source

fn set_current_thread(&mut self, thread: ForeignBox<Thread<K>>)

Source

pub fn current_thread_id(&self) -> usize

Source

pub fn current_thread_name(&self) -> &'static str

Source

pub fn take_current_thread(&mut self) -> ForeignBox<Thread<K>>

Source

pub fn current_thread(&self) -> &Thread<K>

Source

pub fn current_thread_mut(&mut self) -> &mut Thread<K>

Source

pub fn current_process_handle(&self) -> ProcessHandle<K>

Source

pub fn add_process_to_list(&mut self, process: ForeignBox<Process<K>>)

§Safety

This method has the same safety preconditions as UnsafeList::push_front_unchecked.

Source

fn get_kernel_process_handle(&self, kernel: K) -> ProcessHandle<K>

Source

pub fn dump(&self, kernel: K)

Trait Implementations§

Source§

impl<K: Kernel> Send for SchedulerState<K>

Source§

impl<K: Kernel> Sync for SchedulerState<K>

Auto Trait Implementations§

§

impl<K> !Freeze for SchedulerState<K>

§

impl<K> !RefUnwindSafe for SchedulerState<K>

§

impl<K> !Unpin for SchedulerState<K>

§

impl<K> !UnsafeUnpin for SchedulerState<K>

§

impl<K> !UnwindSafe for SchedulerState<K>

§

impl<K> Forget for SchedulerState<K>

§

impl<K> Move for SchedulerState<K>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
Source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

Source§

fn cast_into(self) -> U

§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
§

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

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

Performs the conversion.