Skip to main content

try_spawn_or_degrade

Function try_spawn_or_degrade 

Source
pub fn try_spawn_or_degrade<F, T>(name: &str, f: F) -> Option<JoinHandle<T>>
where F: FnOnce() -> T + Send + 'static, T: Send + 'static,
Expand description

Spawn f on a named thread, returning None (instead of panicking) if the OS refuses the thread. Use only where a missing thread is safe: the work is best-effort and its absence changes no output. Load-bearing threads must keep propagating the error.