release

Release a permit back to the TSemaphore.

import arrow.fx.stm.TSemaphore
import arrow.fx.stm.atomically

suspend fun main() {
//sampleStart
val tsem = TSemaphore.new(5)
atomically {
tsem.release()
}
//sampleEnd
println("Permits remaining ${atomically { tsem.available() }}")
}

This function never retries.


Release n permits back to the TSemaphore.

import arrow.fx.stm.TSemaphore
import arrow.fx.stm.atomically

suspend fun main() {
//sampleStart
val tsem = TSemaphore.new(5)
atomically {
tsem.release(2)
}
//sampleEnd
println("Permits remaining ${atomically { tsem.available() }}")
}

n must be non-negative.

This function never retries.