Module mcslock::lock_api

source ·
Available on crate features lock_api and barging only.
Expand description

Locking interfaces for MCS lock that are compatible with lock_api.

This module exports lock_api::Mutex and lock_api::MutexGuard type aliases with a barging MCS lock and guard as their inner types. The barging::Mutex type will implement the lock_api::RawMutex trait when this feature is enabled.

The Mutex is generic over the relax strategy. User may choose a strategy as long as it implements the Relax trait. There is a number of strategies provided by the relax module. The following modules provide type aliases for lock_api::Mutex and lock_api::MutexGuard associated with one relax strategy. See their documentation for more information.

Modules§

  • A barging MCS lock alias that rapidly spins without telling the CPU to do any power down during lock contention.
  • A barging MCS lock alias that signals the processor that it is running a busy-wait spin-loop during lock contention.
  • yieldsyield
    A barging MCS lock alias that yields the current time slice to the OS scheduler during lock contention.

Type Aliases§

  • A lock that provides mutually exclusive data access that is compatible with lock_api.
  • A guard that provides mutable data access that is compatible with lock_api.