Module sync

Source
Expand description

Data access synchronization objects.

These synchronization objects are similar to those in the std::sync module, but they prevent data races when dealing with multiple actors (users or programs) instead of multiple threads considered in classic synchronization objects.

The following is an overview of the available synchronization objects:

  • Mutex: The Mutual Exclusion mechanism guarantees that during execution, only a single actor can access data at any given time.
  • RwLock: Provides a mutual exclusion mechanism that allows multiple readings by different actors while allowing only one writer at the execution. In some cases, this can be more efficient than a mutex.

Structs§

Mutex
A mutual exclusion primitive useful for protecting shared data.
MutexGuard
An RAII implementation of a “scoped lock” of a mutex. When this structure is dropped (falls out of scope), the lock will be unlocked.
MutexLockFuture
The future returned by the lock method.
RwLock
A reader-writer lock.
RwLockReadFuture
The future returned by the read method.
RwLockReadGuard
RAII structure used to release the shared read access of a lock when dropped.
RwLockWriteFuture
The future returned by the write method.
RwLockWriteGuard
RAII structure used to release the exclusive write access of a lock when dropped.