Dispatchers

expect object Dispatchers(source)

Groups various implementations of CoroutineDispatcher.

actual object Dispatchers(source)
actual object Dispatchers(source)

Groups various implementations of CoroutineDispatcher.

actual object Dispatchers(source)

Properties

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

The CoroutineDispatcher that is designed for offloading blocking IO tasks to a shared pool of threads. Additional threads in this pool are created on demand. Default IO pool size is 64; on JVM it can be configured using JVM-specific mechanisms, please refer to Dispatchers.IO documentation on JVM platform.

Link copied to clipboard

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

Link copied to clipboard

A coroutine dispatcher that is not confined to any specific thread. It executes the initial continuation of a coroutine 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. Nested coroutines launched in this dispatcher form an event-loop to avoid stack overflows.

Functions

Link copied to clipboard

Shuts down built-in dispatchers, such as Default and IO, stopping all the threads associated with them and making them reject all new tasks. Dispatcher used as a fallback for time-related operations (delay, withTimeout) and to handle rejected tasks from other dispatchers is also shut down.