pub unsafe fn spawn<T: 'static + Send, A: 'static>(
stack: &'static mut [u8],
priority: u8,
entry: fn(&'static A) -> T,
arg: &'static A,
) -> Result<TaskHandle, SpawnError>Expand description
Spawn a preemptive task with its own stack.
entry receives arg (a 'static reference — no heap allocation
needed since the argument just needs to outlive the task, and tasks
never exit). Returns the assigned task id, or None if the task
registry (tcb::MAX_PTASKS) is full.
§Safety
stack must not be shared with any other task and must remain valid
(i.e. 'static) for as long as the task runs.