interceptContinuation

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
abstract fun <T> interceptContinuation(
    continuation: Continuation<T>
): Continuation<T>

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.

© 2010–2021 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.coroutines/-continuation-interceptor/intercept-continuation.html