Skip to main content

resolve_thread_count

Function resolve_thread_count 

Source
pub fn resolve_thread_count(
    raw: Option<String>,
    default: usize,
    maximum: usize,
) -> usize
Expand description

Resolve an env-derived thread count: parse the raw value, treat a missing, non-numeric, OR zero value as “unset” and fall back to default, then clamp the result to maximum. A 0 must never survive here because the host’s module-init path feeds this count into a constructor that rejects 0: RuntimeOptions validation rejects a 0 thread count, which would panic an expect() during addon load over what may be a simple typo in an environment variable.