July 2018
Intermediate to advanced
266 pages
7h 11m
English
As mentioned, the implementation of interceptContinuation() in CoroutineDispatcher is returning a DispatchedContinuation. This class is what pairs a CoroutineDispatcher with a Continuation<T>.
So let's take a look at it. First let's start with its constructor and the interfaces that it implements:
internal class DispatchedContinuation<in T>( @JvmField val dispatcher: CoroutineDispatcher, @JvmField val continuation: Continuation<T>) : Continuation<T> by continuation, DispatchedTask<T> { ...}
Notice that it takes a dispatcher and a continuation in the constructor, and it implements both Continuation<T> and DispatchedTask<T>. Its implementation of resume() and resumeWithException() is where the continuation and the dispatcher ...
Read now
Unlock full access