[−][src]Struct spin::relax::Spin
A strategy that rapidly spins while informing the CPU that it should power down non-essential components via
core::hint::spin_loop
.
Note that spinning is a 'dumb' strategy and most schedulers cannot correctly differentiate it from useful work, thereby misallocating even more CPU time to the spinning process. This is known as 'priority inversion'.
If you see signs that priority inversion is occurring, consider switching to [Yield
] or, even better, not using a
spinlock at all and opting for a proper scheduler-aware lock. Remember also that different targets, operating
systems, schedulers, and even the same scheduler with different workloads will exhibit different behaviour. Just
because priority inversion isn't occurring in your tests does not mean that it will not occur. Use a scheduler-
aware lock if at all possible.
Trait Implementations
impl RelaxStrategy for Spin
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,