Module glommio::sync [−][src]
Expand description
Set of synchronization primitives.
This create provides set of synchronization primitives which are optimized to be used inside of fibers which are driven by single-thread bounded executor.
Following primitives are provided.
-
Semaphore - A counting semaphore. Semaphore maintains a set of permits. Each call to [‘acquire_permit’] suspends fiber if necessary until a permit is available, and then takes it. Each call to [‘signal’] adds a permit, potentially releasing a suspended acquirer. There is also [‘try_acquire’] method which fails if semaphore lacks of permits requested without suspending the fiber.
-
RwLock - Implementation of read-write lock optimized for single-thread bounded executor. All methods of RwLock have the same meaning as the methods of
std::sync::RwLock
. With exception that RwLock can not be poisoned but can be closed.
Structs
Facility to achieve graceful shutdown by waiting for the dependent tasks to complete.
A visitor pass which could be acquired when entering a gate, and should be released before the gate is closed.
The permit is A RAII-friendly way to acquire semaphore resources.
A reader-writer lock
RAII structure used to release the shared read access of a lock when dropped.
RAII structure used to release the exclusive write access of a lock when dropped.
An implementation of semaphore that doesn’t use helper threads, condition variables, and is friendly to single-threaded execution.
The static permit is A RAII-friendly way to acquire semaphore resources in long-lived operations that require a static lifetime.
Type Definitions
A type alias for the result of a lock method which can be suspended.
A type alias for the result of a non-suspending locking method.