You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ignore exception on cancel/fail race in CancellableContinuation
There seems to be no other way to satisfactory fix the problem of
a race between cancellation on CancellationContinuation and
concurrent failure of the corresponding background process in a
way the distinguishes "failure from cancellation attempt" from
a "true failure" without placing undue burden on anyone who is
implementing `await()` extension function for various future types.
- Added testTimeoutCancellationFailRace that works as a perfect litmus
test; being allowed to run for a while it realiable detects various
problems in alternative approaches.
- Optimized CancellableContinuationImpl; merged its code with
AbstractContinuation class that is not needed as a separate
class and it removed.
- Deprecated and hidden CancellableContinuation.initCancellability();
it is now always invoked after the end of the block that was
passed to suspendCancellableCoroutine.
- Deprecated `holdCancellability` parameter to an internal
suspendAtomicCancellableCoroutine function.
Fixes#892Fixes#830
Copy file name to clipboardExpand all lines: binary-compatibility-validator/reference-public-api/kotlinx-coroutines-core.txt
+14-3
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ public final class kotlinx/coroutines/BuildersKt {
34
34
public abstract interface class kotlinx/coroutines/CancellableContinuation : kotlin/coroutines/Continuation {
35
35
public abstract fun cancel (Ljava/lang/Throwable;)Z
36
36
public abstract fun completeResume (Ljava/lang/Object;)V
37
-
public abstract fun initCancellability ()V
37
+
public abstract synthetic fun initCancellability ()V
38
38
public abstract fun invokeOnCancellation (Lkotlin/jvm/functions/Function1;)V
39
39
public abstract fun isActive ()Z
40
40
public abstract fun isCancelled ()Z
@@ -50,17 +50,28 @@ public final class kotlinx/coroutines/CancellableContinuation$DefaultImpls {
50
50
public static synthetic fun tryResume$default (Lkotlinx/coroutines/CancellableContinuation;Ljava/lang/Object;Ljava/lang/Object;ILjava/lang/Object;)Ljava/lang/Object;
51
51
}
52
52
53
-
public class kotlinx/coroutines/CancellableContinuationImpl : java/lang/Runnable, kotlin/coroutines/jvm/internal/CoroutineStackFrame, kotlinx/coroutines/CancellableContinuation {
53
+
public class kotlinx/coroutines/CancellableContinuationImpl : kotlin/coroutines/jvm/internal/CoroutineStackFrame, kotlinx/coroutines/CancellableContinuation {
54
54
public fun <init> (Lkotlin/coroutines/Continuation;I)V
55
+
public fun cancel (Ljava/lang/Throwable;)Z
55
56
public fun completeResume (Ljava/lang/Object;)V
56
57
public fun getCallerFrame ()Lkotlin/coroutines/jvm/internal/CoroutineStackFrame;
57
58
public fun getContext ()Lkotlin/coroutines/CoroutineContext;
59
+
public fun getContinuationCancellationCause (Lkotlinx/coroutines/Job;)Ljava/lang/Throwable;
60
+
public final fun getDelegate ()Lkotlin/coroutines/Continuation;
61
+
public final fun getResult ()Ljava/lang/Object;
58
62
public fun getStackTraceElement ()Ljava/lang/StackTraceElement;
59
63
public fun getSuccessfulResult (Ljava/lang/Object;)Ljava/lang/Object;
60
-
public fun initCancellability ()V
64
+
public synthetic fun initCancellability ()V
65
+
public fun invokeOnCancellation (Lkotlin/jvm/functions/Function1;)V
66
+
public fun isActive ()Z
67
+
public fun isCancelled ()Z
68
+
public fun isCompleted ()Z
61
69
protected fun nameString ()Ljava/lang/String;
62
70
public fun resumeUndispatched (Lkotlinx/coroutines/CoroutineDispatcher;Ljava/lang/Object;)V
63
71
public fun resumeUndispatchedWithException (Lkotlinx/coroutines/CoroutineDispatcher;Ljava/lang/Throwable;)V
72
+
public fun resumeWith (Ljava/lang/Object;)V
73
+
public fun takeState ()Ljava/lang/Object;
74
+
public fun toString ()Ljava/lang/String;
64
75
public fun tryResume (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
65
76
public fun tryResumeWithException (Ljava/lang/Throwable;)Ljava/lang/Object;
0 commit comments