pub struct TaskInner { /* private fields */ }
multitask
only.Expand description
The inner task structure.
Implementations§
Source§impl TaskInner
impl TaskInner
Sourcepub fn new<F>(entry: F, name: String, stack_size: usize) -> Self
pub fn new<F>(entry: F, name: String, stack_size: usize) -> Self
Create a new task with the given entry function and stack size.
Sourcepub fn join(&self) -> Option<i32>
pub fn join(&self) -> Option<i32>
Wait for the task to exit, and return the exit code.
It will return immediately if the task has already exited (but not dropped).
Sourcepub unsafe fn task_ext_ptr(&self) -> *mut u8
pub unsafe fn task_ext_ptr(&self) -> *mut u8
Returns the pointer to the user-defined task extended data.
§Safety
The caller should not access the pointer directly, use TaskExtRef::task_ext
or TaskExtMut::task_ext_mut
instead.
Sourcepub fn init_task_ext<T: Sized>(&mut self, data: T) -> Option<&T>
pub fn init_task_ext<T: Sized>(&mut self, data: T) -> Option<&T>
Initialize the user-defined task extended data.
Returns a reference to the task extended data if it has not been
initialized yet (empty), otherwise returns None
.
Sourcepub const fn ctx_mut(&mut self) -> &mut TaskContext
pub const fn ctx_mut(&mut self) -> &mut TaskContext
Returns a mutable reference to the task context.
Sourcepub const fn kernel_stack_top(&self) -> Option<VirtAddr>
pub const fn kernel_stack_top(&self) -> Option<VirtAddr>
Returns the top address of the kernel stack.
Sourcepub fn cpu_id(&self) -> u32
pub fn cpu_id(&self) -> u32
Returns the CPU ID where the task is running or will run.
Note: the task may not be running on the CPU, it just exists in the run queue.
Sourcepub fn cpumask(&self) -> AxCpuMask
pub fn cpumask(&self) -> AxCpuMask
Gets the cpu affinity mask of the task.
Returns the cpu affinity mask of the task in type AxCpuMask
.