simon.vergauwen
02/04/2019, 1:25 PMstartCoroutineCancellable
?altavir
02/04/2019, 1:30 PMstartCoroutineCancellable
?simon.vergauwen
02/04/2019, 1:32 PMaltavir
02/04/2019, 1:35 PMkotlinx.coroutines
simon.vergauwen
02/04/2019, 1:35 PMaltavir
02/04/2019, 1:36 PMsimon.vergauwen
02/04/2019, 1:36 PMaltavir
02/04/2019, 1:37 PMsimon.vergauwen
02/04/2019, 1:38 PMScope
and Job
startCancellableContinuation
Vsevolod Tolstopyatov [JB]
02/04/2019, 1:56 PMstartCoroutineCancellable
is internal API and is not intended to be used externally.
E.g. it is cancellable only when it is used with interceptor from kotlinx.coroutines
and when used on instance of DispatchedContinuation
simon.vergauwen
02/04/2019, 1:57 PMstartCoroutine
to bridge between suspending world and non suspending world but there is no way to take in account cancellation as far as I know.Vsevolod Tolstopyatov [JB]
02/04/2019, 1:57 PMsuspendCancellableCoroutine
simon.vergauwen
02/04/2019, 2:03 PMsuspend () -> A
on a given CoroutineContext
within a Continuation
.class Fx<A>(val fa: suspend () -> A) {
...
fun startOn(ctx: CoroutineContext): Fx<Fiber<ForFx, A>> =
Fx {
val promise = UnsafePromise<A>()
fa.startCoroutine(asyncContinuation(ctx) { either ->
either.fold(
{ promise.complete(it.left()) },
{ promise.complete(it.right()) }
)
})
val cancel: Fx<Unit> = Fx { Unit /* cancel running coroutine */ }
FxFiber(promise, cancel)
}
}
val cancel: Fx<Unit> = Fx { Unit /* cancel running coroutine */ }is the piece of code I am still missing
Pair(join, cancel)