Instrumented Dispatcher Provider
A DispatcherProvider whose main, io and default dispatchers are InstrumentedDispatchers, created by instrumented. unconfined is returned unwrapped: it never queues work, so its counters would always read zero, and yield() on a wrapped one would count a dispatch that never starts.
Diagnostic tool, opt-in, not meant for production. Wrapping Dispatchers.IO loses its elasticity and limitedParallelism hints.
Rules: DISPATCH_005. See docs/BEST_PRACTICES_COROUTINES.md.
Requires opting in to ExperimentalStructuredCoroutines. Not constructed directly; use instrumented.
Properties
Dispatcher for CPU-bound work.
Dispatcher for blocking IO. The default implementation resolves it through ioCompat.
UI dispatcher. May be unavailable on platforms without a main dispatcher (for example a plain JVM process without a UI toolkit); in that case accessing it fails the way Dispatchers.Main does.
Unconfined dispatcher. Runs in the caller thread until the first suspension; avoid for work that needs thread affinity.
Functions
Wraps this provider's main, io and default dispatchers in InstrumentedDispatchers with those labels; unconfined is returned as is (see InstrumentedDispatcherProvider). Wrapping is lazy: nothing (including Dispatchers.Main) is read until the corresponding property is accessed.
Stats of the dispatchers that have been read at least once, in main, io, default order. Dispatchers never accessed are omitted.
Wraps this provider's main, io and default dispatchers in TracingDispatchers labeled "main", "io" and "default" that report to sink. unconfined is returned as is.