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 Effect (https://github.com/typelevel/cats-effect/pull/403)
The number of permits currently available.
Releases a single permit.
Releases a specified number of permits.
Releases a specified number of permits.
If fibers are currently suspended until enough permits are available, they will be woken up (in FIFO order) if this action releases enough of them.
Acquires a permit, executes the action and releases the permit right after.
Acquires a permit in a zio.ZManaged and releases the permit in the finalizer.
Acquires n
permits, executes the action and releases the permits right after.
Acquires n
permits in a zio.ZManaged and releases the permits in the finalizer.
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.