Constructs a semaphore.
Either the maximum simultaneous acquires permitted, or semaphore
initialization parameters. 1
by default.
The maximum simultaneous acquires permitted.
Acquires lock.
Decreases the number of available permits when available, or blocks until one available.
Optional
acquirer: AbortSignalA promise resolved either immediately if permit available, or once permit becomes available after release call. This promise may be rejected with LockFailedError when semaphore closed, or when the lock acquire aborted.
acquirer - Semaphore acquire abort signal. The returned promise would be rejected once the acquire aborted.
Closes semaphore and aborts all pending lock acquires with the given reason
.
Locks can not be acquired once semaphore closed. All acquire method calls would result to an error after that.
Optional acquire abort reason. Defaults to LockFailedError with appropriate message.
Generated using TypeDoc
Semaphore instance.
Permits pre-configured maximum simultaneous acquires.
It is expected that each acquire is followed by corresponding release.