Function crossbeam_utils::scoped::scope
[−]
[src]
pub fn scope<'a, F, R>(f: F) -> R where
F: FnOnce(&Scope<'a>) -> R,
Create a new scope
, for deferred destructors.
Scopes, in particular, support scoped thread spawning.
Examples
Creating and using a scope:
crossbeam_utils::scoped::scope(|scope| { scope.defer(|| println!("Exiting scope")); scope.spawn(|| println!("Running child thread in scope")) }); // Prints messages in the reverse order written
Panics
scoped::scope()
panics if a spawned thread panics but it is not joined inside the scope.