Skip to main content

effective_threads

Function effective_threads 

Source
pub fn effective_threads(policy: &RuntimePolicy, detected_cores: usize) -> usize
Expand description

Resolve the effective thread cap for a policy given a detected core count.

An explicit max_threads > 0 wins (clamped to the detected cores so we never over-subscribe). Otherwise the thermal mode derives the cap: Cool ≈ quarter of cores, Balanced ≈ half, MaxPerf = all. The result is always in 1..=cores. Pure function — deterministic given its inputs.