Function riot_wrappers::thread::scope

source ·
pub fn scope<'env, F, R>(callback: F) -> R
where F: for<'id> FnOnce(&mut CountingThreadScope<'env, 'id>) -> R,
Expand description

Create a context for starting threads that take shorter than ’static references.

Inside the scope, threads can be created using the .spawn() method of the scope passed in, similar to the scoped-threads RFC (which resembles crossbeam’s threads). Unlike that, the scope has no dynamic memory of the spawned threads, and no actual way of waiting for a thread. If the callback returns, the caller has call the scope’s .reap() method with all the threads that were launched; otherwise, the program panics.