Struct task_struct::TaskInner

source ·
pub struct TaskInner {
    pub saved_sp: usize,
    pub kstack: Stack,
    pub pinned_cpu: Option<CpuId>,
    pub kill_handler: Option<KillHandler>,
    pub restart_info: Option<RestartInfo>,
    pub waker: Option<Waker>,
    /* private fields */
}
Expand description

The parts of a Task that may be modified after its creation.

This includes only the parts that cannot be modified atomically. As such, they are protected by a lock in the containing Task struct.

In general, other crates cannot obtain a mutable reference to a Task (&mut Task), which means they cannot access this struct’s contents directly at all (except through the specific get/set methods exposed by Task).

Therefore, it is safe to expose all members of this struct as public, though not strictly necessary. Currently, we only publicize the fields here that need to be modified externally, primarily by the spawn and task crates for creating and running new tasks.

Fields§

§saved_sp: usize

the saved stack pointer value, used for task switching.

§kstack: Stack

The kernel stack, which all Tasks must have in order to execute.

§pinned_cpu: Option<CpuId>

Whether or not this task is pinned to a certain CPU. The idle tasks are always pinned to their respective CPU.

§kill_handler: Option<KillHandler>

The function that will be called when this Task panics or fails due to a machine exception. It will be invoked before the task is cleaned up via stack unwinding. This is similar to Rust’s built-in panic hook, but is also called upon a machine exception, not just a panic.

§restart_info: Option<RestartInfo>

Stores the restartable information of the task. Some(RestartInfo) indicates that the task is restartable.

§waker: Option<Waker>

The waker that is awoken when this task completes.

Auto Trait Implementations§

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,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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.