Dispatchers

Learn what a dispatcher is and some of its types.

A necessary functionality offered by the Kotlin coroutines library lets us decide which thread (or pool of threads) a coroutine should be running (starting and resuming). We’ll do this using a dispatcher.

The English dictionary defines a dispatcher as “a person responsible for sending people or vehicles to where they are needed, especially emergency vehicles.” In Kotlin coroutines, CoroutineContext determines which thread a certain coroutine will run.

Note: Dispatchers in Kotlin Coroutines are a similar concept to RxJava Schedulers.

Get hands-on with 1200+ tech skills courses.