Skip to main content

spawn

Function spawn 

Source
pub fn spawn<F: FnOnce() + Send + 'static>(
    name: &str,
    f: F,
) -> Result<TaskId, &'static str>
Expand description

Spawn a kernel thread running f.

name is copied into a leaked allocation so it satisfies the &'static str field of Task; kernel threads are few and long-lived, so this is bounded.

Returns the TaskId of the new task once it is registered with the scheduler (it may not have started running yet).