-
Notifications
You must be signed in to change notification settings - Fork 944
Open
Labels
Description
Hi,
Currently I found that You do it this way
val job = async(CommonPool) { run(params) }
launch(UI) { onResult.invoke(job.await()) }
Can we just create one coroutine here and just do context switching to execute the UI block code, maybe something like this
launch(CommonPool + job) {
val result = async(coroutineContext) { run(params) }
withContext(UI) { onResult.invoke(result.await()) }
}
And the job on this sample is a private property for cancellation purpose.
By the way, thank you so much for always providing us with such an awesome resources. 👍 🙇
Martindgadr and android10