rayon_core::registry

Function in_worker

Source
pub(crate) fn in_worker<OP, R>(op: OP) -> R
where OP: FnOnce(&WorkerThread, bool) -> R + Send, R: Send,
Expand description

If already in a worker-thread, just execute op. Otherwise, execute op in the default thread-pool. Either way, block until op completes and return its return value. If op panics, that panic will be propagated as well. The second argument indicates true if injection was performed, false if executed directly.