Function rayon_core::in_place_scope [−][src]
pub fn in_place_scope<'scope, OP, R>(op: OP) -> R where
OP: FnOnce(&Scope<'scope>) -> R,
Expand description
Creates a “fork-join” scope s
and invokes the closure with a
reference to s
. This closure can then spawn asynchronous tasks
into s
. Those tasks may run asynchronously with respect to the
closure; they may themselves spawn additional tasks into s
. When
the closure returns, it will block until all tasks that have been
spawned into s
complete.
This is just like scope()
except the closure runs on the same thread
that calls in_place_scope()
. Only work that it spawns runs in the
thread pool.
Panics
If a panic occurs, either in the closure given to in_place_scope()
or in
any of the spawned jobs, that panic will be propagated and the
call to in_place_scope()
will panic. If multiple panics occurs, it is
non-deterministic which of their panic values will propagate.
Regardless, once a task is spawned using scope.spawn()
, it will
execute, even if the spawning task should later panic. in_place_scope()
returns once all spawned jobs have completed, and any panics are
propagated at that point.