diff --git a/common/kotlinx-coroutines-core-common/src/CancellableContinuation.kt b/common/kotlinx-coroutines-core-common/src/CancellableContinuation.kt index ca0d5806ed..b50ca7a79a 100644 --- a/common/kotlinx-coroutines-core-common/src/CancellableContinuation.kt +++ b/common/kotlinx-coroutines-core-common/src/CancellableContinuation.kt @@ -29,8 +29,10 @@ import kotlin.jvm.* * * A [cancelled][isCancelled] continuation implies that it is [completed][isCompleted]. * - * Invocation of [resume] or [resumeWithException] in _resumed_ state produces [IllegalStateException] - * but is ignored in _cancelled_ state. + * Invocation of [resume] or [resumeWithException] in _resumed_ state produces [IllegalStateException]. + * Invocation of [resume] in _cancelled_ state is ignored (it is a trivial race between resume from the continuation owner and + * outer job cancellation and cancellation wins). + * Invocation of [resumeWithException] in _cancelled_ state triggers exception handling of passed exception. * * ``` * +-----------+ resume +---------+