File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,12 @@ import kotlin.coroutines.suspendCoroutine
1313 * If the cancel reason was not a [CancellationException], then the original exception is added as cause of the
1414 * [CancellationException] that this continuation resumes with.
1515 */
16- public interface CancellableContinuation <in T > : Continuation <T >, Job
16+ public interface CancellableContinuation <in T > : Continuation <T >, Job {
17+ /* *
18+ * Returns `true` if this continuation was cancelled. It implies that [isActive] is `false`.
19+ */
20+ val isCancelled: Boolean
21+ }
1722
1823/* *
1924 * Suspend coroutine similar to [suspendCoroutine], but provide an implementation of [CancellableContinuation] to
@@ -56,6 +61,9 @@ internal class SafeCancellableContinuation<in T>(
5661 return state
5762 }
5863
64+ override val isCancelled: Boolean
65+ get() = getState() is Cancelled
66+
5967 @Suppress(" UNCHECKED_CAST" )
6068 override fun afterCompletion (state : Any? ) {
6169 if (suspendedThread == = Thread .currentThread()) {
You can’t perform that action at this time.
0 commit comments