Counting semaphore.
Semaphore.acquire returns a promise that is resolved once a permit is available.
If a permit is currently available, the returned promise is already resolved.
Semaphore.release either resolves one waiting promise or increments the available permits.
- lock : Std.Mutex SemaphoreState
Instances For
Creates a new semaphore with permits initially available permits.
Instances For
Requests one permit. Returns a promise that resolves once the permit is acquired.
Instances For
Tries to acquire a permit without blocking. Returns true on success.
Instances For
Releases one permit and resolves one waiting acquirer, if any.
Instances For
Returns the number of currently available permits.