elizarov
09/11/2017, 3:17 PMEmptyCoroutineContext
and Unconfined
are virtually the same with the exception that Unconfined
is designed to work with debugging facilities of kotlinx.coroutines
(in debug mode you’ll get the id of the executing coroutine added to the thread name — wastes a lot of CPU, but simplifies debugging)
7 replies
Btw, the pair of async(ctx) { ... }.await()
is the same as run(ctx) { ... }
. I’d recommend to always use the later, since it makes your intent to switch to another context more explicit and I don’t have to look at the last line with await
to see what was your intent of using async
.