pub struct Placement {
pub core: usize,
pub wait: WaitStrategy,
}Expand description
Where one pipeline thread runs and how it waits there.
The two are one value because they constrain each other: a thread
that busy-spins needs a core to itself, and a thread with no core of
its own (core == 0, the unpinned sentinel) can only ever yield — a
spinner the scheduler is free to place is the co-location bug with
the victim chosen at random. PipelineCores::validate enforces the
cross-thread half of that rule; the constructors here enforce the
per-thread half.
Fields§
§core: usizeLogical CPU to pin to. 0 = unpinned (OS scheduled).
wait: WaitStrategyHow the thread waits when it has nothing to do.
Implementations§
Source§impl Placement
impl Placement
Sourcepub const fn spinning(core: usize) -> Self
pub const fn spinning(core: usize) -> Self
Pinned to core and busy-spinning: the thread owns that core.
A core of 0 cannot spin — see the type docs — so this yields
the unpinned placement instead.
Sourcepub const fn yielding(core: usize) -> Self
pub const fn yielding(core: usize) -> Self
Pinned to core, spinning briefly then yielding: the thread may
share that core with other yielding threads.