arrow-fx / arrow.fx / IO / runAsyncCancellable

runAsyncCancellable

fun runAsyncCancellable(onCancel: OnCancel = Silent, cb: (Either<Throwable, A>) -> IOOf<Unit>): IO<Disposable>

A pure version of unsafeRunAsyncCancellable, it defines how an IO is ran in a cancelable manner but it doesn’t run yet.

It receives the values in a callback cb and thus has the ability to run NonBlocking but that depends on the implementation. When the underlying effects/program runs blocking on the callers thread this method will run blocking.

Parameters

cb - the callback that is called with the computations result represented as an Either.

Return a Disposable that can be used to cancel the computation.

See Also

unsafeRunAsync

unsafeRunAsyncCancellable

Do you like Arrow?

Arrow Org
<