# Struct parking_lot_core::SpinWait [−] [src]

    pub struct SpinWait { /* fields omitted */ }

A counter used to perform exponential backoff in spin loops.

## Implementations

### `impl SpinWait` [src]

#### `pub fn new() -> Self` [src]

Creates a new `SpinWait`.

#### `pub fn reset(&mut self)` [src]

Resets a `SpinWait` to its initial state.

#### `pub fn spin(&mut self) -> bool` [src]

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.

#### `pub fn spin_no_yield(&mut self)` [src]

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

### `impl Default for SpinWait` [src]

#### `fn default() -> SpinWait` [src]

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

## Auto Trait Implementations

### `impl RefUnwindSafe for SpinWait`

### `impl Send for SpinWait`

### `impl Sync for SpinWait`

### `impl Unpin for SpinWait`

### `impl UnwindSafe for SpinWait`

## Blanket Implementations

### `impl<T> Any for T where
T: 'static + ?Sized,` [src]

#### `pub fn type_id(&self) -> TypeId` [src]

Gets the `TypeId` of `self`. Read more

### `impl<T> Borrow<T> for T where
T: ?Sized,` [src]

#### `pub fn borrow(&self) -> &T` [src]

Immutably borrows from an owned value. Read more

### `impl<T> BorrowMut<T> for T where
T: ?Sized,` [src]

#### `pub fn borrow_mut(&mut self) -> &mut T` [src]

Mutably borrows from an owned value. Read more

### `impl<T> From<T> for T` [src]

#### `pub fn from(t: T) -> T` [src]

Performs the conversion.

### `impl<T, U> Into<U> for T where
U: From<T>,` [src]

#### `pub fn into(self) -> U` [src]

Performs the conversion.

### `impl<T, U> TryFrom<U> for T where
U: Into<T>,` [src]

#### `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]

Performs the conversion.

### `impl<T, U> TryInto<U> for T where
U: TryFrom<T>,` [src]

#### `type Error = <U as TryFrom<T>>::Error`

The type returned in the event of a conversion error.

#### `pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>` [src]

Performs the conversion.