Acquires a number of permits, waiting until enough permits are available.
The number of permits to acquire.
A promise that isn't resolved until the requested number of permits is available.
The promise will never be rejected.
If the given number of permits is negative.
Acquires a single permit if one is available.
true
if at least one permit is available, or false
otherwise.
Acquires a number permit if enough are available.
The number of permits to acquire.
true
if enough permits are available, or false
otherwise.
If the given number of permits is negative.
Tries to acquire a number of permits, waiting until enough are available.
The options used to acquire permits.
A promise that isn't resolved until enough permits are available or the given timeout expires, whichever occurs first.
If enough permits become available before the timeout expires, the promise will be resolved with true
.
If the timeout expires or is not positive, the promise will be resolved with false
.
If the timeout is not positive, the promise will be resolved immediately.
The promise will never be rejected.
If the given options specifies a negative number of permits.
The number of initial permits.