arrow-fx-coroutines / arrow.fx.coroutines / Semaphore / releaseN
abstract suspend fun releaseN(n:
Long
):
Unit
Releases n permits, potentially unblocking outstanding acquires.
import arrow.fx.coroutines.*
suspend fun main(): Unit {
//sampleStart
val semaphore = Semaphore(5)
semaphore.acquireN(5)
semaphore.releaseN(3)
val available = semaphore.available()
//sampleEnd
println("available: available")
}
n
- number of permits to release; must be greater or equal than zero.
Do you like Arrow?
✖