pub struct Mutex<T> { /* private fields */ }
Expand description

Atomic mutual exclusion

similar to std::sync::Mutex.

A mutex can be used

  • as a simple and efficient form of communication between tasks, by synchronizing acces to share data between multiple tasks
  • to protect data races on shared data or peripherals

Example

Implementations

Try to lock the mutex (non-blocking). Returns a MutexGuard or an error if the mutex is not available or poisoned.

Try to lock the mutex (blocking). Returns a MutexGuard or an error if the request timed out or the mutex was poisoned.

Note: The timeout function is not implemented yet.

Trait Implementations

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.