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>
impl<Traits: KernelCfg2> State<Traits>
sourcepub fn running_task_ptr(&self) -> *mut Option<&'static TaskCb<Traits>>
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.