Struct itron_asp3::task::Task [−][src]
pub struct Task(_);
This is supported on crate features
unstable
and dcre
only.Expand description
An owned task.
Deletes the task automatically when dropped. The destructor will panic if the deletion fails.
Implementations
acre_tsk
: Create a builder for Task
.
Example
use itron::task::Task;
let captured_variable = 42u16;
let task = Task::build()
.start(move || { let _ = captured_variable; })
.stack_size(4096)
.initial_priority(4)
.finish_and_activate()
.expect("failed to create a task");
task.as_ref().wake().expect("failed to send a wake up request to the created task");
// The created task might be still active, so if we just let `task`
// go out of scope, its destructor will panic. `Task::leak` consumes
// `Task` and prevents the destructor from running.
task.leak();
Consume and “leak” self
, returning a reference TaskRef<'a>
.
Get the raw object ID as abi::NonNullID
.