Module bern_kernel::task[][src]

Expand description

Task creation and control.

Example

Create a task using the builder pattern:

let mut heartbeat = board.shield.led_1;
Task::new()
    .priority(Priority(0))
    .static_stack(kernel::alloc_static_stack!(512))
    .spawn(move || {
        loop {
            kernel::sleep(200);
            heartbeat.toggle().ok();
        }
    });

The task builder (TaskBuilder) is used to configure a task. On TaskBuilder::spawn() the information is passed to the scheduler and the task is put into ready state.

Tasks can be spawened from main() or within other tasks.

Structs

Priority

Task priority.

Task

Task control block

TaskBuilder

Builder to create a new task

Enums

Transition

Transition for next context switch

Type Definitions

RunnableResult

Issue with closures and static tasks