net.sf.asyncobjects.asyncscala.util
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
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
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
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 by one permit
Reduce by one permit
a promise that resolve when permit is reduced
release a single permit
release a single permit
a promise that resolves when a permit is released
A classical semaphore that allows acquiring, reducing, and releasing permits. The acquire and reduce operations are ordered, the next operation starts executing only if previously received one has completed, so the semaphore behaves fairly with respect to these methods. The release operation is executed as soon as it is received, possibly resuming waiting acquire and reduce operations.