Function crossbeam::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::scope(|scope| { scope.defer(|| println!("Exiting scope")); scope.spawn(|| println!("Running child thread in scope")) }); // Prints messages in the reverse order written