available
Returns the currently available number of permits in a TSemaphore.
import arrow.fx.stm.TSemaphore
import arrow.fx.stm.atomically
suspend fun main() {
//sampleStart
val tsem = TSemaphore.new(5)
val result = atomically {
tsem.available()
}
//sampleEnd
println("Result $result")
println("Permits remaining ${atomically { tsem.available() }}")
}
Content copied to clipboard
This function never retries.