alexcouch
09/12/2018, 4:54 AMalexcouch
09/12/2018, 5:31 AMDico
09/12/2018, 5:35 AMCoroutineDispatcher
, you get to write the code that submits tasks to executors.
The easiest way to do this would be like so:Dico
09/12/2018, 5:37 AMDico
09/12/2018, 5:37 AMclass MyCoroutineDispatcher(override var executor: Executor) : ExecutorCoroutineDispatcherBase()
val DISPATCHER = MyCoroutineDispatcher(Executors.newSingleThreadExecutor())
Dico
09/12/2018, 5:38 AMexecutor
used. It might be a good idea to mark the executor
property @Volatile
.
By using only single threaded executors, you can control exactly which thread is used.