pub struct ThreadPoolConfig {
pub timing: PoolSpec,
pub io: PoolSpec,
pub workers: usize,
}Expand description
Resolved, immutable process-wide thread-pool configuration.
Fields§
§timing: PoolSpecLow-jitter periodic dispatch (the cadence scheduler).
io: PoolSpecOffloaded reporter / report I/O.
workers: usizeThe tokio async runtime worker-thread count (consumed by the runtime
builder in nmbrs-runtime; the registry does not own that runtime).
Implementations§
Source§impl ThreadPoolConfig
impl ThreadPoolConfig
Sourcepub fn defaults() -> Self
pub fn defaults() -> Self
Reasonable defaults derived from the core count (SRD-102 §3): 1 timing
thread (RR + auto-pin), 2 io threads, workers = cores − reserved.
On < 3 cores the reservation degrades (workers gets at least 1; the
timing pin/RR still applies but shares a core — logged at spawn).
Sourcepub fn resolve() -> Result<Self, String>
pub fn resolve() -> Result<Self, String>
Overlay NMBRS_THREADS_* env vars onto the defaults. Returns Err on a
malformed value (never silently ignored). The nmbrs binary layers CLI
flags on top of this before calling init.
Sourcepub fn resolve_with_cli(cli: &CliThreadOverrides) -> Result<Self, String>
pub fn resolve_with_cli(cli: &CliThreadOverrides) -> Result<Self, String>
Resolve with CLI --threads.* flags layered on top of env + defaults,
giving the CLI > env > defaults precedence of SRD-102 §4. Parsing
lives here (not in the nmbrs binary) so a malformed CLI value is the
SAME hard error as the env path — via the same SchedPolicy::parse /
Affinity::parse and thread-count parsing, never silently coerced.