Struct freertos_rs::patterns::compute_task::ComputeTask
[−]
[src]
pub struct ComputeTask<R> { /* fields omitted */ }
A task that can terminate and return its return value. Implemented using an atomically shared mutex.
Sample usage:
use freertos_rs::patterns::compute_task::*; let task = Task::new().compute(|| { CurrentTask::delay(Duration::ms(100)); 42 }).unwrap(); let result = task.into_result(Duration::ms(1000)).unwrap();
Methods
impl<R: Debug> ComputeTask<R>
[src]
fn get_task(&self) -> &Task
[src]
Get the handle of the task that computes the result.
fn wait_for_result<D: DurationTicks>(
&mut self,
max_wait: D
) -> Result<(), FreeRtosError>
[src]
&mut self,
max_wait: D
) -> Result<(), FreeRtosError>
Wait until the task computes its result. Otherwise, returns a timeout.
fn into_result<D: DurationTicks>(self, max_wait: D) -> Result<R, FreeRtosError>
[src]
Consume the task and unwrap the computed return value.