Skip to main content

agave_cpu_utils/
lib.rs

1#![cfg(all(feature = "agave-unstable-api", target_os = "linux"))]
2
3//! CPU affinity utilities for Linux systems.
4//!
5//! This crate provides safe Rust bindings for setting CPU affinity and querying
6//! the current task affinity mask. Useful for performance-critical applications
7//! that need precise control over thread placement.
8//!
9//! # Examples
10//!
11//! ```no_run
12//! use agave_cpu_utils::*;
13//!
14//! # fn main() -> std::io::Result<()> {
15//! let allowed = cpu_affinity(None)?;
16//! if let Some(&cpu) = allowed.first() {
17//!     set_cpu_affinity(None, [cpu])?;
18//! }
19//! # Ok(())
20//! # }
21//! ```
22//!
23
24mod affinity;
25
26pub use affinity::{CpuId, cpu_affinity, set_cpu_affinity};