Acquires a single permit.
Acquires a single permit. This must be paired with release
in a safe
fashion in order to avoid leaking permits.
If a permit is not available, the fiber invoking this method will be suspended until a permit is available.
Acquires a specified number of permits.
Acquires a specified number of permits.
If the specified number of permits are not available, the fiber invoking this method will be suspended until the permits are available.
Ported from @mpilquist work in cats-effects (https://github.com/typelevel/cats-effect/pull/403)
The number of permits currently available.
The total number of permits allocated to the semaphore.
Releases a single permit.
An asynchronous semaphore, which is a generalization of a mutex. Semaphores have a certain number of permits, which can be held and released concurrently by different parties. Attempts to acquire more permits than available result in the acquiring fiber being suspended until the specified number of permits become available.