Skip to content

Commit 39a6f64

Browse files
committed
New channels algo
1 parent 70c4f92 commit 39a6f64

30 files changed

+1978
-679
lines changed

gradle/test-mocha-js.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ task testMochaNode(type: NodeTask, dependsOn: [compileTestJsLegacy, installDepen
2929

3030
def jsLegacyTestTask = project.tasks.findByName('jsLegacyTest') ? jsLegacyTest : jsTest
3131

32-
jsLegacyTestTask.dependsOn testMochaNode
32+
//jsLegacyTestTask.dependsOn testMochaNode
3333

3434
// -- Testing with Mocha under headless Chrome
3535

@@ -99,5 +99,5 @@ task testMochaJsdom(type: NodeTask, dependsOn: [compileTestJsLegacy, installDepe
9999
if (project.hasProperty("teamcity")) args += ['--reporter', 'mocha-teamcity-reporter']
100100
}
101101

102-
jsLegacyTestTask.dependsOn testMochaJsdom
102+
//jsLegacyTestTask.dependsOn testMochaJsdom
103103

kotlinx-coroutines-core/api/kotlinx-coroutines-core.api

+5-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public final class kotlinx/coroutines/CancellableContinuation$DefaultImpls {
5151
public static synthetic fun tryResume$default (Lkotlinx/coroutines/CancellableContinuation;Ljava/lang/Object;Ljava/lang/Object;ILjava/lang/Object;)Ljava/lang/Object;
5252
}
5353

54-
public class kotlinx/coroutines/CancellableContinuationImpl : kotlin/coroutines/jvm/internal/CoroutineStackFrame, kotlinx/coroutines/CancellableContinuation {
54+
public class kotlinx/coroutines/CancellableContinuationImpl : kotlin/coroutines/jvm/internal/CoroutineStackFrame, kotlinx/coroutines/CancellableContinuation, kotlinx/coroutines/channels/Waiter {
5555
public fun <init> (Lkotlin/coroutines/Continuation;I)V
5656
public final fun callCancelHandler (Lkotlinx/coroutines/CancelHandler;Ljava/lang/Throwable;)V
5757
public final fun callOnCancellation (Lkotlin/jvm/functions/Function1;Ljava/lang/Throwable;)V
@@ -855,6 +855,9 @@ public final class kotlinx/coroutines/channels/TickerMode : java/lang/Enum {
855855
public static fun values ()[Lkotlinx/coroutines/channels/TickerMode;
856856
}
857857

858+
public abstract interface class kotlinx/coroutines/channels/Waiter {
859+
}
860+
858861
public final class kotlinx/coroutines/debug/internal/DebugCoroutineInfo {
859862
public fun <init> (Lkotlinx/coroutines/debug/internal/DebugCoroutineInfoImpl;Lkotlin/coroutines/CoroutineContext;)V
860863
public final fun getContext ()Lkotlin/coroutines/CoroutineContext;
@@ -1276,7 +1279,7 @@ protected final class kotlinx/coroutines/selects/SelectImplementation$ClauseData
12761279
public final fun tryRegister (Lkotlinx/coroutines/selects/SelectImplementation;)Z
12771280
}
12781281

1279-
public abstract interface class kotlinx/coroutines/selects/SelectInstance {
1282+
public abstract interface class kotlinx/coroutines/selects/SelectInstance : kotlinx/coroutines/channels/Waiter {
12801283
public abstract fun disposeOnCompletion (Lkotlinx/coroutines/DisposableHandle;)V
12811284
public abstract fun getContext ()Lkotlin/coroutines/CoroutineContext;
12821285
public abstract fun selectInRegistrationPhase (Ljava/lang/Object;)V

kotlinx-coroutines-core/build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ task jvmStressTest(type: Test, dependsOn: compileTestKotlinJvm) {
242242
systemProperty 'kotlinx.coroutines.scheduler.keep.alive.sec', '100000' // any unpark problem hangs test
243243
systemProperty 'kotlinx.coroutines.semaphore.segmentSize', '2'
244244
systemProperty 'kotlinx.coroutines.semaphore.maxSpinCycles', '10'
245+
systemProperty 'kotlinx.coroutines.bufferedChannel.segmentSize', '2'
245246
}
246247

247248
task jvmLincheckTest(type: Test, dependsOn: compileTestKotlinJvm) {
@@ -260,6 +261,7 @@ static void configureJvmForLincheck(task) {
260261
'--add-exports', 'java.base/jdk.internal.util=ALL-UNNAMED'] // in the model checking mode
261262
task.systemProperty 'kotlinx.coroutines.semaphore.segmentSize', '2'
262263
task.systemProperty 'kotlinx.coroutines.semaphore.maxSpinCycles', '1' // better for the model checking mode
264+
task.systemProperty 'kotlinx.coroutines.bufferedChannel.segmentSize', '2'
263265
}
264266

265267
// Always check additional test sets

kotlinx-coroutines-core/common/src/CancellableContinuationImpl.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package kotlinx.coroutines
66

77
import kotlinx.atomicfu.*
8+
import kotlinx.coroutines.channels.Waiter
89
import kotlinx.coroutines.internal.*
910
import kotlin.coroutines.*
1011
import kotlin.coroutines.intrinsics.*
@@ -26,7 +27,7 @@ internal val RESUME_TOKEN = Symbol("RESUME_TOKEN")
2627
internal open class CancellableContinuationImpl<in T>(
2728
final override val delegate: Continuation<T>,
2829
resumeMode: Int
29-
) : DispatchedTask<T>(resumeMode), CancellableContinuation<T>, CoroutineStackFrame {
30+
) : DispatchedTask<T>(resumeMode), CancellableContinuation<T>, CoroutineStackFrame, Waiter {
3031
init {
3132
assert { resumeMode != MODE_UNINITIALIZED } // invalid mode for CancellableContinuationImpl
3233
}

kotlinx-coroutines-core/common/src/channels/ArrayChannel.kt

-208
This file was deleted.

kotlinx-coroutines-core/common/src/channels/BufferOverflow.kt

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
package kotlinx.coroutines.channels
66

7-
import kotlinx.coroutines.*
8-
97
/**
108
* A strategy for buffer overflow handling in [channels][Channel] and [flows][kotlinx.coroutines.flow.Flow] that
119
* controls what is going to be sacrificed on buffer overflow:

0 commit comments

Comments
 (0)