AsyncSemaphoreUtils class

Semaphore: at most permits concurrent acquisitions.

Constructors

AsyncSemaphoreUtils(int permits)
Creates a semaphore allowing at most permits concurrent acquisitions.

Properties

hashCode int
The hash code for this object.
no setterinherited
permits int
Maximum number of concurrent acquisitions allowed.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

acquire() Future<void>
Waits for a permit, then acquires it (decrements available count). Completes when a permit is available. Throws Object if the underlying future completes with an error.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
release() → void
Releases one permit (increments available count); unblocks one waiter if any.
run<T>(AsyncAction<T> fn) Future<T>
Acquires a permit, runs fn, then releases; ensures release on exception.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited