interceptContinuation

Common
JVM
JS
Native
1.0
abstract fun <T> interceptContinuation(
    continuation: Continuation<T>
): Continuation<T>

(source)

Returns continuation that wraps the original continuation, thus intercepting all resumptions. This function is invoked by coroutines framework when needed and the resulting continuations are cached internally per each instance of the original continuation.

This function may simply return original continuation if it does not want to intercept this particular continuation.

When the original continuation completes, coroutine framework invokes releaseInterceptedContinuation with the resulting continuation if it was intercepted, that is if interceptContinuation had previously returned a different continuation instance.