Function rayon_core::spawn_fifo

source ·
pub fn spawn_fifo<F>(func: F)
where F: FnOnce() + Send + 'static,
Expand description

Fires off a task into the Rayon threadpool in the “static” or “global” scope. Just like a standard thread, this task is not tied to the current stack frame, and hence it cannot hold any references other than those with 'static lifetime. If you want to spawn a task that references stack data, use the scope_fifo() function to create a scope.

The behavior is essentially the same as the spawn function, except that calls from the same thread will be prioritized in FIFO order. This is similar to the now- deprecated breadth_first option, except the effect is isolated to relative spawn_fifo calls, not all threadpool tasks.

For more details on this design, see Rayon RFC #1.

§Panic handling

If this closure should panic, the resulting panic will be propagated to the panic handler registered in the ThreadPoolBuilder, if any. See ThreadPoolBuilder::panic_handler() for more details.