julioyg
04/23/2018, 1:47 PMsuspendCoroutine
so:
suspend fun myFunc = suspendCancellableCoroutine{continuation ->
myObservable.subscribe(onsuccess={continuation.resume(it)}, onError={continuation.resume(error(it)})
continuation.invokeOnCompletion(onCancelling = true) {disposable.dispose()}}
Thing is that when I cancel the coroutine that calls the function, it doesn't dispose the observable, is there anyway to make the function to cancel immediately? as the doc says even if the coroutine is cancelled it doesn't mean that the code will be cancelled but instead we should check regularly inside that code whether is't cancelled or not, but, is there any alternative?Vsevolod Tolstopyatov [JB]
04/23/2018, 3:31 PMonSubscribe = { d-> continuation.disposeOnCompletion(d)}
Vsevolod Tolstopyatov [JB]
04/23/2018, 3:32 PM