cpu
cpu utility
features
- thread affinity for current or selected linux thread ids
- online cpu counting and iteration
- physical core counting
- cache line padding
- atomic cursor helpers
- cpu pause, fences, and prefetch helpers
- spin, yield, and backoff wait strategies
affinity
use set_current_thread_affinity when a worker pins itself during startup.
use current_thread_id and set_cpu_affinity when the caller owns the target thread id.
hot path
cursor, fence, prefetch, cache padding, and wait strategy operations avoid heap allocation.
affinity and topology calls are cold path setup operations and may read sysfs or call the kernel.