[][src]Module smol::lock

Async synchronization primitives.

This crate provides the following primitives:

  • Barrier - enables tasks to synchronize all together at the same time.
  • Mutex - a mutual exclusion lock.
  • RwLock - a reader-writer lock, allowing any number of readers or a single writer.
  • Semaphore - limits the number of concurrent operations.

Structs

Barrier

A counter to synchronize multiple tasks at the same time.

BarrierWaitResult

Returned by Barrier::wait() when all tasks have called it.

Mutex

An async mutex.

MutexGuard

A guard that releases the mutex when dropped.

MutexGuardArc

An owned guard that releases the mutex when dropped.

RwLock

An async reader-writer lock.

RwLockReadGuard

A guard that releases the read lock when dropped.

RwLockUpgradableReadGuard

A guard that releases the upgradable read lock when dropped.

RwLockWriteGuard

A guard that releases the write lock when dropped.

Semaphore

A counter for limiting the number of concurrent operations.

SemaphoreGuard

A guard that releases the acquired permit.

SemaphoreGuardArc

An owned guard that releases the acquired permit.