pub trait TaskMethods: TaskHandle {
    // Provided methods
    fn activate(&self) -> Result<(), ActivateTaskError> { ... }
    fn interrupt(&self) -> Result<(), InterruptTaskError> { ... }
    fn unpark(&self) -> Result<(), UnparkError> { ... }
    fn unpark_exact(&self) -> Result<(), UnparkExactError> { ... }
    fn set_priority(&self, priority: usize) -> Result<(), SetTaskPriorityError>
       where Self::System: KernelTaskSetPriority { ... }
    fn priority(&self) -> Result<usize, GetTaskPriorityError> { ... }
    fn effective_priority(&self) -> Result<usize, GetTaskPriorityError> { ... }
}
Expand description

The supported operations on TaskHandle.

Provided Methods§

source

fn activate(&self) -> Result<(), ActivateTaskError>

Start the execution of the task.

source

fn interrupt(&self) -> Result<(), InterruptTaskError>

Interrupt any ongoing wait operations undertaken by the task.

This method interrupt any ongoing system call that is blocking the task. The interrupted system call will return WaitError::Interrupted or WaitTimeoutError::Interrupted.

source

fn unpark(&self) -> Result<(), UnparkError>

Make the task’s token available, unblocking Kernel::park now or in the future.

If the token is already available, this method will return without doing anything. Use Self::unpark_exact if you need to detect this condition.

If the task is currently being blocked by Kernel::park, the token will be immediately consumed. Otherwise, it will be consumed on a next call to Kernel::park.

source

fn unpark_exact(&self) -> Result<(), UnparkExactError>

Make exactly one new token available for the task, unblocking Kernel::park now or in the future.

If the token is already available, this method will return UnparkExactError::QueueOverflow. Thus, this method will succeed only if it made exactly one token available.

If the task is currently being blocked by Kernel::park, the token will be immediately consumed. Otherwise, it will be consumed on a next call to Kernel::park.

source

fn set_priority(&self, priority: usize) -> Result<(), SetTaskPriorityError>where Self::System: KernelTaskSetPriority,

Set the task’s base priority.

A task’s base priority is used to calculate its effective priority. Tasks with lower effective priorities execute first. The base priority is reset to the initial value specified by TaskDefiner::priority upon activation.

The value must be in range 0..num_task_priority_levels. Otherwise, this method will return SetTaskPriorityError::BadParam.

The task shouldn’t be in the Dormant state. Otherwise, this method will return SetTaskPriorityError::BadObjectState.

source

fn priority(&self) -> Result<usize, GetTaskPriorityError>

Get the task’s base priority.

The task shouldn’t be in the Dormant state. Otherwise, this method will return GetTaskPriorityError::BadObjectState.

source

fn effective_priority(&self) -> Result<usize, GetTaskPriorityError>

Get the task’s effective priority.

The effective priority is calculated based on the task’s base priority and can be temporarily raised by a mutex locking protocol.

The task shouldn’t be in the Dormant state. Otherwise, this method will return GetTaskPriorityError::BadObjectState.

Implementors§