riot_wrappers::thread::riot_c::creation

Function create

Source
unsafe fn create<R>(
    stack: &mut [u8],
    closure: &mut R,
    name: &CStr,
    priority: u8,
    flags: i32,
) -> (kernel_pid_t, Option<*mut thread_t>)
where R: Send + FnMut(),
Expand description

Internal helper that does all the casting but relies on the caller to establish appropriate lifetimes.

This also returns a pointer to the created thread’s control block inside the stack; that TCB can be used to get the thread’s status even when the thread is already stopped and the PID may have been reused for a different thread. For short-lived threads that are done before this function returns, the TCB may be None.