Skip to main content

pin_thread

Function pin_thread 

Source
pub fn pin_thread(cores: &[usize])
Expand description

Pin the calling thread to the given set of logical CPUs.

ยงPlatform behaviour

OSSemantics
LinuxSets the CPU affinity mask to the union of the given cores
via sched_setaffinity. Pass multiple cores to restrict the
thread to a cluster (e.g. all P-cores).
macOSUses the first core as an opaque affinity tag; threads with
the same tag are co-scheduled by the Mach scheduler. Extra
cores are ignored (macOS has no multi-core mask).
OtherNo-op.

An empty slice is a no-op on all platforms.