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.

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
SemaphoreAcquireFailureException
Exception thrown to futures cancelled by BoundedSemaphore.cancelAll or Semaphore.cancelAll