Function rayon::in_place_scope_fifo
source · pub fn in_place_scope_fifo<'scope, OP, R>(op: OP) -> Rwhere
OP: FnOnce(&ScopeFifo<'scope>) -> R,
Expand description
Creates a “fork-join” scope s
with FIFO order, 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_fifo()
except the closure runs on the same thread
that calls in_place_scope_fifo()
. Only work that it spawns runs in the
thread pool.
Panics
If a panic occurs, either in the closure given to in_place_scope_fifo()
or in
any of the spawned jobs, that panic will be propagated and the
call to in_place_scope_fifo()
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_fifo()
, it will
execute, even if the spawning task should later panic. in_place_scope_fifo()
returns once all spawned jobs have completed, and any panics are
propagated at that point.