Acquire the specified amount of permits.
Acquire the specified amount of permits. The operation waits until the specified amount of permits will be available, after that the amount of available permits is increased by the specified amount.
the amount or permits requested
a promise that resolves when permits are taken
The variant of acquire operation that takes a single permit
The variant of acquire operation that takes a single permit
a promise that resolve when permit is acquired
Reduce the amount of available permits by the specified amount.
Reduce the amount of available permits by the specified amount. This operation does not waits until the amount of permits is available, but it waits until all previously registered acquire and reduce requests are processed. Using negative permits it is possible to track some some interesting conditions like amount of started worker operations.
the amount or permits requested
a promise that resolves when permits are taken
Reduce by one permit
Reduce by one permit
a promise that resolve when permit is reduced
Release the specified amount of permits.
Release the specified amount of permits. If there are waiting acquire and reduce operations, they are resumed if the specified amount of permits allows it.
the amount or permits released
a promise that resolves when permits are released
release a single permit
release a single permit
a promise that resolves when a permit is released
Implementation of semaphore service