July 2018
Intermediate to advanced
266 pages
7h 11m
English
CoroutineDispatcher is an abstract implementation of ContinuationInterceptor that is used for the implementation of all the provided dispatchers, such as CommonPool, Unconfined, and DefaultDispatcher. Let's look at its code:
public abstract class CoroutineDispatcher : AbstractCoroutineContextElement(ContinuationInterceptor), ContinuationInterceptor { open fun isDispatchNeeded(context: CoroutineContext): Boolean = true abstract fun dispatch(context: CoroutineContext, block: Runnable) override fun <T> interceptContinuation(continuation: Continuation<T>): Continuation<T> = DispatchedContinuation(this, continuation) public operator fun plus(other: CoroutineDispatcher) = other override fun toString(): String = "$classSimpleName@$hexAddress" ...Read now
Unlock full access