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
Breaking: Get rid of atomic cancellation and provide a replacement (Kotlin#1937)
This is a problematic for Android when Main dispatcher is cancelled on destroyed activity.
Atomic nature of channels is designed to prevent loss of elements,
which is really not an issue for a typical application, but creates problem when used with channels.
* Internal suspendAtomicCancellableCoroutine -> suspendCancellableCoroutine
* Internal suspendAtomicCancellableCoroutineReusable -> suspendCancellableCoroutineReusable
* Remove atomic cancellation from docs
* Ensures that flowOn does not resume downstream after cancellation.
* MODE_ATOMIC_DEFAULT renamed into MODE_ATOMIC
* Introduced MODE_CANCELLABLE_REUSABLE to track suspendCancellableCoroutineReusable
* Better documentation for MODE_XXX constants.
* Added stress test for proper handling of MODE_CANCELLABLE_REUSABLE
and fixed test for Kotlin#1123 bug with job.join (working in MODE_CANCELLABLE) that was not
properly failing in the absence of the proper code in CancellableContinuationImpl.getResult
* Added test for Flow.combine that should be fixed
* Support extended invokeOnCancellation contract
* Introduced internal tryResumeAtomic
* Channel onUnderliveredElement is introduced as a replacement.
FixesKotlin#1265FixesKotlin#1813FixesKotlin#1915FixesKotlin#1936
Co-authored-by: Louis CAD <[email protected]>
Co-authored-by: Vsevolod Tolstopyatov <[email protected]>
Copy file name to clipboardExpand all lines: kotlinx-coroutines-core/api/kotlinx-coroutines-core.api
+7-8
Original file line number
Diff line number
Diff line change
@@ -46,6 +46,7 @@ public abstract interface class kotlinx/coroutines/CancellableContinuation : kot
46
46
public abstract fun resumeUndispatched (Lkotlinx/coroutines/CoroutineDispatcher;Ljava/lang/Object;)V
47
47
public abstract fun resumeUndispatchedWithException (Lkotlinx/coroutines/CoroutineDispatcher;Ljava/lang/Throwable;)V
48
48
public abstract fun tryResume (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
49
+
public abstract fun tryResume (Ljava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
49
50
public abstract fun tryResumeWithException (Ljava/lang/Throwable;)Ljava/lang/Object;
50
51
}
51
52
@@ -56,6 +57,8 @@ public final class kotlinx/coroutines/CancellableContinuation$DefaultImpls {
56
57
57
58
public class kotlinx/coroutines/CancellableContinuationImpl : kotlin/coroutines/jvm/internal/CoroutineStackFrame, kotlinx/coroutines/CancellableContinuation {
58
59
public fun <init> (Lkotlin/coroutines/Continuation;I)V
60
+
public final fun callCancelHandler (Lkotlinx/coroutines/CancelHandler;Ljava/lang/Throwable;)V
61
+
public final fun callOnCancellation (Lkotlin/jvm/functions/Function1;Ljava/lang/Throwable;)V
59
62
public fun cancel (Ljava/lang/Throwable;)Z
60
63
public fun completeResume (Ljava/lang/Object;)V
61
64
public fun getCallerFrame ()Lkotlin/coroutines/jvm/internal/CoroutineStackFrame;
@@ -75,14 +78,12 @@ public class kotlinx/coroutines/CancellableContinuationImpl : kotlin/coroutines/
75
78
public fun resumeWith (Ljava/lang/Object;)V
76
79
public fun toString ()Ljava/lang/String;
77
80
public fun tryResume (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
81
+
public fun tryResume (Ljava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
78
82
public fun tryResumeWithException (Ljava/lang/Throwable;)Ljava/lang/Object;
79
83
}
80
84
81
85
public final class kotlinx/coroutines/CancellableContinuationKt {
82
86
public static final fun disposeOnCancellation (Lkotlinx/coroutines/CancellableContinuation;Lkotlinx/coroutines/DisposableHandle;)V
83
-
public static final fun suspendAtomicCancellableCoroutine (Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
84
-
public static final fun suspendAtomicCancellableCoroutine (ZLkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
85
-
public static synthetic fun suspendAtomicCancellableCoroutine$default (ZLkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
86
87
public static final fun suspendCancellableCoroutine (Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
87
88
}
88
89
@@ -272,10 +273,6 @@ public final class kotlinx/coroutines/DelayKt {
272
273
public static final fun delay-p9JZ4hM (DLkotlin/coroutines/Continuation;)Ljava/lang/Object;
273
274
}
274
275
275
-
public final class kotlinx/coroutines/DispatchedContinuationKt {
276
-
public static final fun resumeCancellableWith (Lkotlin/coroutines/Continuation;Ljava/lang/Object;)V
277
-
}
278
-
279
276
public final class kotlinx/coroutines/Dispatchers {
280
277
public static final field INSTANCE Lkotlinx/coroutines/Dispatchers;
281
278
public static final fun getDefault ()Lkotlinx/coroutines/CoroutineDispatcher;
@@ -613,8 +610,10 @@ public final class kotlinx/coroutines/channels/ChannelIterator$DefaultImpls {
613
610
}
614
611
615
612
public final class kotlinx/coroutines/channels/ChannelKt {
616
-
public static final fun Channel (I)Lkotlinx/coroutines/channels/Channel;
613
+
public static final synthetic fun Channel (I)Lkotlinx/coroutines/channels/Channel;
614
+
public static final fun Channel (ILkotlin/jvm/functions/Function1;)Lkotlinx/coroutines/channels/Channel;
617
615
public static synthetic fun Channel$default (IILjava/lang/Object;)Lkotlinx/coroutines/channels/Channel;
616
+
public static synthetic fun Channel$default (ILkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lkotlinx/coroutines/channels/Channel;
618
617
}
619
618
620
619
public final class kotlinx/coroutines/channels/ChannelsKt {
0 commit comments