pub struct LocalTask<System>(_, _)
where
System: KernelBase;
Expand description
A non-Send
, 'static
task reference. The lack of Send
-ness constrains
its lifetime to the owning task and thus allows it to represent a current
task safely.
See TaskRef
for the Send
counterpart.
See TaskMethods
for the operations provided by this handle
type.
Implementations
sourceimpl<System> LocalTask<System> where
System: KernelBase,
impl<System> LocalTask<System> where
System: KernelBase,
sourcepub fn current() -> Result<LocalTask<System>, GetCurrentTaskError>
pub fn current() -> Result<LocalTask<System>, GetCurrentTaskError>
Get the current task (i.e., the task that is assigned to the current processor and in the Running state).
Returns GetCurrentTaskError::BadContext
if called from a non-task
context.
Rationale: Getting a current task in a non-task context does make sense, but the result may be soon invalidated (potentially violating the [object safety] of
LocalTask
) and made unreliable by various factors.
Trait Implementations
sourceimpl<System> Clone for LocalTask<System> where
System: KernelBase,
impl<System> Clone for LocalTask<System> where
System: KernelBase,
sourceimpl<System> Debug for LocalTask<System> where
System: KernelBase,
impl<System> Debug for LocalTask<System> where
System: KernelBase,
sourceimpl<System> Hash for LocalTask<System> where
System: KernelBase,
impl<System> Hash for LocalTask<System> where
System: KernelBase,
sourceimpl<System, T> PartialEq<T> for LocalTask<System> where
System: KernelBase,
T: TaskHandle<System = System>,
impl<System, T> PartialEq<T> for LocalTask<System> where
System: KernelBase,
T: TaskHandle<System = System>,
sourceimpl<System> TaskHandle for LocalTask<System> where
System: KernelBase,
impl<System> TaskHandle for LocalTask<System> where
System: KernelBase,
type System = System
type System = System
The system type this object pertains to.
sourceconst unsafe fn from_id(
id: <System as KernelBase>::RawTaskId
) -> LocalTask<System>
const unsafe fn from_id(
id: <System as KernelBase>::RawTaskId
) -> LocalTask<System>
Construct a Task
from RawTaskId
. Read more
sourceconst fn id(&self) -> <System as KernelBase>::RawTaskId
const fn id(&self) -> <System as KernelBase>::RawTaskId
Get the raw RawTaskId
value representing this object.
impl<System> Copy for LocalTask<System> where
System: KernelBase,
impl<System> Eq for LocalTask<System> where
System: KernelBase,
impl<System> Sync for LocalTask<System> where
System: KernelBase,
Auto Trait Implementations
impl<System> RefUnwindSafe for LocalTask<System> where
<System as KernelBase>::RawTaskId: RefUnwindSafe,
impl<System> !Send for LocalTask<System>
impl<System> Unpin for LocalTask<System> where
<System as KernelBase>::RawTaskId: Unpin,
impl<System> UnwindSafe for LocalTask<System> where
<System as KernelBase>::RawTaskId: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> TaskMethods for T where
T: TaskHandle,
impl<T> TaskMethods for T where
T: TaskHandle,
sourcefn activate(&self) -> Result<(), ActivateTaskError>
fn activate(&self) -> Result<(), ActivateTaskError>
Start the execution of the task.
sourcefn interrupt(&self) -> Result<(), InterruptTaskError>
fn interrupt(&self) -> Result<(), InterruptTaskError>
Interrupt any ongoing wait operations undertaken by the task. Read more
sourcefn unpark(&self) -> Result<(), UnparkError>
fn unpark(&self) -> Result<(), UnparkError>
Make the task’s token available, unblocking Kernel::park
now or in
the future. Read more
sourcefn unpark_exact(&self) -> Result<(), UnparkExactError>
fn unpark_exact(&self) -> Result<(), UnparkExactError>
Make exactly one new token available for the task, unblocking
Kernel::park
now or in the future. Read more
sourcefn set_priority(&self, priority: usize) -> Result<(), SetTaskPriorityError> where
Self::System: KernelTaskSetPriority,
fn set_priority(&self, priority: usize) -> Result<(), SetTaskPriorityError> where
Self::System: KernelTaskSetPriority,
Set the task’s base priority. Read more
sourcefn priority(&self) -> Result<usize, GetTaskPriorityError>
fn priority(&self) -> Result<usize, GetTaskPriorityError>
Get the task’s base priority. Read more
sourcefn effective_priority(&self) -> Result<usize, GetTaskPriorityError>
fn effective_priority(&self) -> Result<usize, GetTaskPriorityError>
Get the task’s effective priority. Read more