arrow-fx-coroutines / arrow.fx.coroutines / Semaphore / available
abstract suspend fun available():
Long
Gets a snapshot of the currently available permits, always non negative.
The semaphore may be out of data instantly; use tryAcquire or tryAcquireN for acquires that immediately return if failed.
import arrow.fx.coroutines.*
suspend fun main(): Unit {
//sampleStart
val semaphore = Semaphore(5)
val available = semaphore.available()
//sampleEnd
println("available: $available")
}
Do you like Arrow?
✖