Crate semaphore

Source
Expand description

Atomic counting semaphore that can help you control access to a common resource by multiple processes in a concurrent system.

§Features

  • Effectively lock-free* semantics
  • Provides RAII-style acquire/release API
  • Implements Send, Sync and Clone

* lock-free when not using the shutdown API

Structs§

Semaphore
Counting semaphore to control concurrent access to a common resource.
SemaphoreGuard
RAII guard used to release access to the semaphore automatically when it falls out of scope.
ShutdownHandle
Handle representing the shutdown process of a semaphore, allowing for extraction of the underlying resource.

Enums§

TryAccessError
Error indicating a failure to acquire access to the resource behind the semaphore.

Type Aliases§

TryAccessResult
Result returned from Semaphore::try_access.