bitkid
02/01/2018, 12:24 PMelizarov
02/01/2018, 12:32 PMasync { ... }
uses CommonPool
dispatcher and doSomething
will be executed in that another thread.christophsturm
02/01/2018, 1:01 PMelizarov
02/01/2018, 1:02 PMasync(ctx) { ... }
christophsturm
02/01/2018, 1:05 PMelizarov
02/01/2018, 1:06 PMUnconfined
runs in the same thread only until the first suspension point.runBlocking
you should be passing coroutineContext
.christophsturm
02/01/2018, 1:07 PMelizarov
02/01/2018, 1:08 PMasync(UI) { … }
and for tests you make UI injectable and use coroutineContext
that’s available inside runBlocking