arrow-fx-coroutines / arrow.fx.coroutines / Environment / unsafeRunAsyncCancellable

unsafeRunAsyncCancellable

open fun unsafeRunAsyncCancellable(fa: suspend () -> Unit): Disposable

Execution strategy that will immediately return and perform the program’s work without blocking the current thread. Runs the operation fa in a cancellable way. Execution can be cancelled by invoking the returned Disposable.

Allows you to run suspend programs that return Unit. When an exception occurs, it will be rethrown.

abstract fun <A> unsafeRunAsyncCancellable(fa: suspend () -> A, e: (Throwable) -> Unit, a: (A) -> Unit): Disposable

Execution strategy that will immediately return and perform the program’s work without blocking the current thread. Runs the operation fa in a cancellable way. Execution can be cancelled by invoking the returned Disposable.

Allows you to run suspend programs that returns A. The result will be passed to a in case of success, or to e in case of an exception.

Do you like Arrow?

Arrow Org
<