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 Task
s 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.