Skip to main content

Module sync

Module sync 

Source
Available on crate feature full only.
Expand description

Provides kernel synchronisation primitives.

§Overview

The following is an overview of the available synchronisation objects:

  • Spinlock: Provides mutual exclusion by busy-waiting until the protected resource is available.
  • RwSpinlock: An alternative to a plain Spinlock which allows for multiple concurrent readers, which can be more efficient for read-heavy workloads.
  • IrqCell: A single-threaded mutual exclusion primitive, similar to RefCell, which attempts to reduce deadlocks by disabling interrupts while locked.
  • OnceLock: Used for thread-safe, one-time initialization of a variable, with potentially different initializers based on the caller.
  • LazyLock: Used for thread-safe, one-time initialization of a variable, using one nullary initializer function provided at creation.

Structs§

IrqCellNon-use_std
An interrupt safe, single-threaded mutable memory location.
IrqGuardNon-use_std
An RAII implementation of a “scoped lock” of an IrqCell. When this structure is dropped (falls out of scope), the lock will be unlocked.
LazyLockNon-use_std
A value which is initialized on the first access.
OnceNon-use_std
A low-level synchronization primitive for one-time global execution.
OnceLockNon-use_std
A synchronization primitive which can nominally be written to only once.

Traits§

SpinlockGuardExtNon-use_std
Extension functions to SpinlockGuard.

Type Aliases§

MappedSpinlockGuardNon-use_std
An RAII spinlock guard returned by SpinlockGuard::map, which can point to a subfield of the protected data.
RwReadGuardNon-use_std
RAII structure used to release the shared read access of a lock when dropped.
RwSpinlockNon-use_std
A reader-writer lock.
RwUpgradableReadGuardNon-use_std
RAII structure used to release upgradable read access of a lock when dropped.
RwWriteGuardNon-use_std
RAII structure used to release the exclusive write access of a lock when dropped.
SpinlockNon-use_std
A mutual exclusion primitive useful for protecting shared data.
SpinlockGuardNon-use_std
An RAII implementation of a “scoped lock” of a spinlock. When this structure is dropped (falls out of scope), the lock will be unlocked.