Expand description
Construction of configured worker thread pools (std-only).
A pool is built from a ThreadPoolConfig into a rayon [ThreadPool] whose
worker threads optionally get:
- a fixed CPU affinity, applied Spread: worker
iis pinned toaffinity[i % affinity.len()], sothreads == affinity.len()yields one worker pinned per dedicated core; and - a scheduling policy/priority (normal/niceness or
SCHED_FIFO/SCHED_RR).
Affinity and scheduling are applied once per worker thread at startup
(never on the per-CopperList hot path), and only when the rt-scheduling
feature is enabled on a supported platform (Linux for real-time policies; CPU
affinity is cross-platform). When the feature is off, the requested affinity
and policy are ignored and a warning is emitted.
Per-pool OnError controls what happens when a request cannot be applied
(for example, setting a real-time priority without CAP_SYS_NICE):
OnError::Warn logs and continues with default scheduling, while
OnError::Strict fails the build.
Functionsยง
- apply_
current_ thread_ scheduling - build_
pool - Builds a rayon thread pool from a declarative
ThreadPoolConfig, applying the configured CPU affinity and scheduling policy/priority to each worker.