Dispatchers

object Dispatchers (source)

Groups various implementations of CoroutineDispatcher.

Properties

Default

val Default: CoroutineDispatcher

The default CoroutineDispatcher that is used by all standard builders like launch, async, etc if no dispatcher nor any other ContinuationInterceptor is specified in their context.

IO

The CoroutineDispatcher that is designed for offloading blocking IO tasks to a shared pool of threads.

Main

A coroutine dispatcher that is confined to the Main thread operating with UI objects. Usually such dispatcher is single-threaded.

Unconfined

val Unconfined: CoroutineDispatcher

A coroutine dispatcher that is not confined to any specific thread. It executes initial continuation of the coroutine immediately in the current call-frame and lets the coroutine resume in whatever thread that is used by the corresponding suspending function, without mandating any specific threading policy. Note: use with extreme caution, not for general code.