Function base::set_cpu_affinity

source ·
pub fn set_cpu_affinity<I: IntoIterator<Item = usize>>(cpus: I) -> Result<()>
Expand description

Set the CPU affinity of the current thread to a given set of CPUs.

Examples

Set the calling thread’s CPU affinity so it will run on only CPUs 0, 1, 5, and 6.

  set_cpu_affinity(vec![0, 1, 5, 6]).unwrap();