set_thread_affinity

Function set_thread_affinity 

Source
pub fn set_thread_affinity(pid: pid_t, cpus: &BTreeSet<usize>) -> Result<()>
Expand description

Set per-thread CPU affinity via sched_setaffinity(2).

pid must be > 0pid <= 0 has broadcast semantics at the syscall level (target the calling task or every task in a tgid depending on layer) and is rejected up-front so no caller passes an unchecked 0 through.