Skip to main content

rayon_threads

Function rayon_threads 

Source
pub fn rayon_threads(default: usize) -> usize
Expand description

Worker count for the global Rayon pool, from XDG parallelism.rayon_threads.

GAP-SG-92: the pool used to be sized by writing RAYON_NUM_THREADS into the process environment at startup, which made an env var the configuration channel and required an unsafe block. Reading the XDG key and handing the number to ThreadPoolBuilder keeps the policy inside the documented precedence and removes the mutation entirely.

A value of 0 is rejected in favour of default: Rayon treats zero as “detect the host CPU count”, which silently discards the cap this knob exists to enforce.