Function gix_features::parallel::threads

source ·
pub fn threads<'env, F, R>(f: F) -> R
where F: for<'scope> FnOnce(&'scope Scope<'scope, 'env>) -> R,
Available on crate feature parallel only.
Expand description

Runs f with a scope to be used for spawning threads that will not outlive the function call. That way it’s possible to handle threads without needing the ’static lifetime for data they interact with.

Note that the threads should not rely on actual parallelism as threading might be turned off entirely, hence should not connect each other with channels as deadlock would occur in single-threaded mode.