[−][src]Macro harsark::spawn
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!"); });