Struct cooptex::CoopMutex[][src]

pub struct CoopMutex<T> { /* fields omitted */ }
Expand description

A deadlock-free version of Mutex.

This is only deadlock-free if:

  1. All Mutexes that may deadlock are CoopMutexes
  2. When Retry is returned, the requesting thread drops all other MutexGuards it is holding. Easily accomplished with retry_loop.

Implementations

Create a new CoopMutex holding the provided item.

Acquire a mutex or return Err(Retry), indicating that the current thread should drop all its currently held locks and try to acquire them again. Use retry_loop to automatically use the correct behavior.

Panics

Panics when a thread attempts to acquire a lock it is already holding.

Returns a mutable reference to the underlying data.

See std::sync::Mutex for more details of implications.

Trait Implementations

Formats the value using the given formatter. Read more

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

Performs the conversion.

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

Extract a subset of the possible types in a coproduct (or get the remaining possibilities) Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the indexed conversion.

Consumes the current HList and returns an HList with the requested shape. Read more

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.