arrow-fx / arrow.fx / Semaphore / uncancellable

uncancellable

fun <F> uncancellable(n: Long, AS: Async<F>): Kind<F, Semaphore<F>>

Construct a Semaphore initialized with n available permits. Since it’s based on Async it’s constrained with an uncancellable acquire operation.

import arrow.fx.*
import arrow.fx.extensions.io.async.async

fun main(args: Array<String>) {
  //sampleStart
  val semaphore = Semaphore.uncancellable<ForIO>(5, IO.async())
  //sampleEnd
}

Do you like Arrow?

Arrow Org
<