Returns the number of available permits.
Executes the specified workflow, acquiring a permit immediately before the workflow begins execution and releasing it immediately after the workflow completes execution, whether by success, failure, or interruption.
Returns a scoped workflow that describes acquiring a permit as the
acquire
action and releasing it as the release
action.
Executes the specified workflow, acquiring the specified number of permits immediately before the workflow begins execution and releasing them immediately after the workflow completes execution, whether by success, failure, or interruption.
Returns a scoped workflow that describes acquiring the specified number of permits and releasing them when the scope is closed.
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.
If you need functionality that
Semaphore
doesnt' provide, use a TSemaphore and define it in a zio.stm.ZSTM transaction.