Last active
June 8, 2020 21:06
-
-
Save raulh82vlc/b59b16062abc0ef07887a5e9100e2070 to your computer and use it in GitHub Desktop.
TaskThreadingImpl with dispatchers instead of schedulers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TaskThreadingImpl @Inject constructor() : TaskThreading { | |
// declaration of dispatchers | |
private val computationCoroutineDispatcher: CoroutineDispatcher = Default | |
private val ioCoroutineDispatcher: CoroutineDispatcher = IO | |
private val mainCoroutineDispatcher: CoroutineDispatcher = Main | |
// other schedulers here | |
// dispatchers: | |
override fun uiDispatcher(): CoroutineDispatcher = mainCoroutineDispatcher | |
override fun ioDispatcher(): CoroutineDispatcher = ioCoroutineDispatcher | |
override fun computationDispatcher(): CoroutineDispatcher = computationCoroutineDispatcher | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment