pub struct SpinWait { /* private fields */ }
Expand description

A counter used to perform exponential backoff in spin loops.

Implementations

Creates a new SpinWait.

Resets a SpinWait to its initial state.

Spins until the sleep threshold has been reached.

This function returns whether the sleep threshold has been reached, at which point further spinning has diminishing returns and the thread should be parked instead.

The spin strategy will initially use a CPU-bound loop but will fall back to yielding the CPU to the OS after a few iterations.

Spins without yielding the thread to the OS.

Instead, the backoff is simply capped at a maximum value. This can be used to improve throughput in compare_exchange loops that have high contention.

Trait Implementations

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.