async_locks library
Provides a suite of synchronization primitives designed to streamline the coordination of asynchronous operations in Dart applications. Inspired by Python's established concurrency features, this package offers a familiar and intuitive approach to managing shared resources and preventing race conditions in asynchronous code.
See also:
Classes
- BoundedSemaphore
- A semaphore object that enforces an upper bound on the internal counter.
- Event
- Event object to notify multiple futures that an event has happened.
- Lock
- Mutex lock to guarantee exclusive access to a shared state.
- Semaphore
- A semaphore object that allows a limited number of futures to acquire it.
- UnfairLock
- An UnfairLock object is identical to a Lock excepts that it wakes up the last future that called acquire instead of the first (i.e. waiting futures are put in a LIFO queue).
- UnfairSemaphore
- A UnfairSemaphore is a synchronization primitive that limits the number of concurrent accesses to a shared resource. It is similar to a Semaphore, but it wakes up the last future that called acquire instead of the first (i.e. waiting futures are put in a LIFO queue).
Exceptions / Errors
- AsyncLocksException
- Base class for all exceptions from this package
- BoundedSemaphoreLimitException
- Exception that may be thrown in BoundedSemaphore.release
- EventCancelledException
- Exception thrown to futures cancelled by Event.cancelAll
- LockAcquireFailureException
- Exception thrown to futures cancelled by Lock.cancelAll or UnfairLock.cancelAll
- SemaphoreAcquireFailureException
- Exception thrown to futures cancelled by Semaphore.cancelAll or UnfairSemaphore.cancelAll