[][src]Macro harsark::spawn

macro_rules! spawn {
    ($priority: expr, $stack: expr, $handler_fn: block) => { ... };
    ($priority: expr, $deadline: expr, $stack: expr, $handler_fn: block) => { ... };
}

The tasks must be looping infinitely and call task_exit whenever a particular task is done. This makes it complicated to create tasks and also might introduce undefined behavior if task_exit is not called. The spawn macro makes it easier to define tasks. It also defines a static variable of type TaskId, which corresponds to the task created.

Examples

shared = 10;
spawn!(task2, 2, stack1, shared, params, {
    hprintln!("{}", params);
});
spawn!(task3, 3, stack2, {
    hprintln!("Hello!");
});