Struct r3_kernel::State

source ·
pub struct State<Traits: KernelCfg2, PortTaskState: 'static = <Traits as PortThreading>::PortTaskState, TaskReadyQueue: 'static = <Traits as KernelCfg1>::TaskReadyQueue, TaskPriority: 'static = <Traits as KernelCfg1>::TaskPriority, TimeoutHeap: 'static = <Traits as KernelCfg2>::TimeoutHeap> { /* private fields */ }
Expand description

Global kernel state.

Implementations§

source§

impl<Traits: KernelCfg2> State<Traits>

source

pub fn running_task_ptr(&self) -> *mut Option<&'static TaskCb<Traits>>

Get a pointer to the variable storing the currently running task.

Reading the variable is safe as long as the read is free of data race. Note that only the dispatcher (that calls PortToKernel::choose_running_task) can modify the variable asynchonously. For example, it’s safe to read it in a task context. It’s also safe to read it in the dispatcher. On the other hand, reading it in a non-task context (except for the dispatcher, of course) may lead to an undefined behavior unless CPU Lock is activated while reading the variable.

Writing the variable is not allowed.

Trait Implementations§

source§

impl<Traits: KernelTraits, PortTaskState: 'static + Debug, TaskReadyQueue: 'static + Debug, TaskPriority: 'static + Debug, TimeoutHeap: 'static + Debug> Debug for State<Traits, PortTaskState, TaskReadyQueue, TaskPriority, TimeoutHeap>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Traits: KernelCfg2, PortTaskState: 'static, TaskReadyQueue: 'static + Init, TaskPriority: 'static, TimeoutHeap: 'static + Init> Init for State<Traits, PortTaskState, TaskReadyQueue, TaskPriority, TimeoutHeap>

source§

const INIT: Self = _

The default value.

Auto Trait Implementations§

§

impl<Traits, PortTaskState = <Traits as PortThreading>::PortTaskState, TaskReadyQueue = <Traits as KernelCfg1>::TaskReadyQueue, TaskPriority = <Traits as KernelCfg1>::TaskPriority, TimeoutHeap = <Traits as KernelCfg2>::TimeoutHeap> !RefUnwindSafe for State<Traits, PortTaskState, TaskReadyQueue, TaskPriority, TimeoutHeap>

§

impl<Traits, PortTaskState, TaskReadyQueue, TaskPriority, TimeoutHeap> Send for State<Traits, PortTaskState, TaskReadyQueue, TaskPriority, TimeoutHeap>where PortTaskState: Sync, TaskPriority: Send + Sync, TaskReadyQueue: Send, TimeoutHeap: Send,

§

impl<Traits, PortTaskState, TaskReadyQueue, TaskPriority, TimeoutHeap> Sync for State<Traits, PortTaskState, TaskReadyQueue, TaskPriority, TimeoutHeap>where PortTaskState: Sync, TaskPriority: Send + Sync, TaskReadyQueue: Sync, TimeoutHeap: Send,

§

impl<Traits, PortTaskState, TaskReadyQueue, TaskPriority, TimeoutHeap> Unpin for State<Traits, PortTaskState, TaskReadyQueue, TaskPriority, TimeoutHeap>where TaskReadyQueue: Unpin, TimeoutHeap: Unpin,

§

impl<Traits, PortTaskState = <Traits as PortThreading>::PortTaskState, TaskReadyQueue = <Traits as KernelCfg1>::TaskReadyQueue, TaskPriority = <Traits as KernelCfg1>::TaskPriority, TimeoutHeap = <Traits as KernelCfg2>::TimeoutHeap> !UnwindSafe for State<Traits, PortTaskState, TaskReadyQueue, TaskPriority, TimeoutHeap>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.