@@ -48,7 +48,7 @@ internal val Int.isCancellableMode get() = this == MODE_CANCELLABLE || this == M
48
48
internal val Int .isReusableMode get() = this == MODE_CANCELLABLE_REUSABLE
49
49
50
50
internal abstract class DispatchedTask <in T >(
51
- @JvmField public var resumeMode : Int
51
+ @JvmField var resumeMode : Int
52
52
) : SchedulerTask() {
53
53
internal abstract val delegate: Continuation <T >
54
54
@@ -151,11 +151,11 @@ internal fun <T> DispatchedTask<T>.dispatch(mode: Int) {
151
151
assert { mode != MODE_UNINITIALIZED } // invalid mode value for this method
152
152
val delegate = this .delegate
153
153
val undispatched = mode == MODE_UNDISPATCHED
154
- if (! undispatched && delegate is DispatchedContinuation <* > && mode.isCancellableMode == resumeMode.isCancellableMode ) {
154
+ if (delegate is DispatchedContinuation <* >) {
155
155
// dispatch directly using this instance's Runnable implementation
156
156
val dispatcher = delegate.dispatcher
157
157
val context = delegate.context
158
- if (dispatcher.isDispatchNeeded(context)) {
158
+ if (! undispatched && dispatcher.isDispatchNeeded(context)) {
159
159
dispatcher.dispatch(context, this )
160
160
} else {
161
161
resumeUnconfined()
@@ -167,7 +167,6 @@ internal fun <T> DispatchedTask<T>.dispatch(mode: Int) {
167
167
}
168
168
}
169
169
170
- @Suppress(" UNCHECKED_CAST" )
171
170
internal fun <T > DispatchedTask<T>.resume (delegate : Continuation <T >, undispatched : Boolean ) {
172
171
// This resume is never cancellable. The result is always delivered to delegate continuation.
173
172
val state = takeState()
@@ -214,7 +213,6 @@ internal inline fun DispatchedTask<*>.runUnconfinedEventLoop(
214
213
}
215
214
}
216
215
217
- @Suppress(" NOTHING_TO_INLINE" )
218
216
internal inline fun Continuation <* >.resumeWithStackTrace (exception : Throwable ) {
219
217
resumeWith(Result .failure(recoverStackTrace(exception, this )))
220
218
}
0 commit comments