Skip to main content

pin_current_thread_to_cpu

Function pin_current_thread_to_cpu 

Source
pub fn pin_current_thread_to_cpu(cpu: usize) -> Result<(), String>
Expand description

Pins the calling thread to the single CPU cpu with sched_setaffinity.

What a crate::robot::target_control loop does right after raising its priority when its options name a cpu: on a host that keeps a core free for it (isolcpus) the loop then never migrates. cpu must be below CPU_SETSIZE and present on the machine; the Err names the cpu and the kernel’s reason.