Showing preview only (5,419K chars total). Download the full file or copy to clipboard to get everything.
Repository: Kotlin/kotlinx.coroutines
Branch: master
Commit: b11abdf01d4d
Files: 1270
Total size: 4.9 MB
Directory structure:
gitextract_93h8727g/
├── .github/
│ └── ISSUE_TEMPLATE/
│ ├── bug_report.md
│ ├── config.yml
│ ├── design_considerations.md
│ ├── feature_request.md
│ ├── guide.md
│ └── rc_feedback.md
├── .gitignore
├── .idea/
│ ├── codeStyleSettings.xml
│ ├── codeStyles/
│ │ ├── Project.xml
│ │ └── codeStyleConfig.xml
│ ├── copyright/
│ │ └── profiles_settings.xml
│ ├── dictionaries/
│ │ └── shared.xml
│ └── vcs.xml
├── CHANGES.md
├── CHANGES_UP_TO_1.7.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE.txt
├── README.md
├── RELEASE.md
├── benchmarks/
│ ├── build.gradle.kts
│ ├── scripts/
│ │ └── generate_plots_flow_flatten_merge.py
│ └── src/
│ ├── jmh/
│ │ ├── java/
│ │ │ └── benchmarks/
│ │ │ └── flow/
│ │ │ └── scrabble/
│ │ │ ├── RxJava2PlaysScrabble.java
│ │ │ ├── RxJava2PlaysScrabbleOpt.java
│ │ │ └── optimizations/
│ │ │ ├── FlowableCharSequence.java
│ │ │ ├── FlowableSplit.java
│ │ │ └── StringFlowable.java
│ │ └── kotlin/
│ │ └── benchmarks/
│ │ ├── ChannelSinkBenchmark.kt
│ │ ├── ChannelSinkDepthBenchmark.kt
│ │ ├── ChannelSinkNoAllocationsBenchmark.kt
│ │ ├── ParametrizedDispatcherBase.kt
│ │ ├── SequentialSemaphoreBenchmark.kt
│ │ ├── akka/
│ │ │ ├── PingPongAkkaBenchmark.kt
│ │ │ └── StatefulActorAkkaBenchmark.kt
│ │ ├── debug/
│ │ │ └── DebugSequenceOverheadBenchmark.kt
│ │ ├── flow/
│ │ │ ├── CombineFlowsBenchmark.kt
│ │ │ ├── CombineTwoFlowsBenchmark.kt
│ │ │ ├── FlatMapMergeBenchmark.kt
│ │ │ ├── FlowFlattenMergeBenchmark.kt
│ │ │ ├── NumbersBenchmark.kt
│ │ │ ├── SafeFlowBenchmark.kt
│ │ │ ├── TakeBenchmark.kt
│ │ │ └── scrabble/
│ │ │ ├── FlowPlaysScrabbleBase.kt
│ │ │ ├── FlowPlaysScrabbleOpt.kt
│ │ │ ├── IterableSpliterator.kt
│ │ │ ├── README.md
│ │ │ ├── ReactorPlaysScrabble.kt
│ │ │ ├── SaneFlowPlaysScrabble.kt
│ │ │ ├── SequencePlaysScrabble.kt
│ │ │ └── ShakespearePlaysScrabble.kt
│ │ └── scheduler/
│ │ ├── DispatchersContextSwitchBenchmark.kt
│ │ ├── ForkJoinBenchmark.kt
│ │ ├── LaunchBenchmark.kt
│ │ ├── StatefulAwaitsBenchmark.kt
│ │ └── actors/
│ │ ├── ConcurrentStatefulActorBenchmark.kt
│ │ ├── CycledActorsBenchmark.kt
│ │ ├── PingPongActorBenchmark.kt
│ │ ├── PingPongWithBlockingContext.kt
│ │ └── StatefulActorBenchmark.kt
│ └── main/
│ └── kotlin/
│ └── benchmarks/
│ └── common/
│ └── BenchmarkUtils.kt
├── build.gradle.kts
├── buildSrc/
│ ├── build.gradle.kts
│ ├── settings.gradle.kts
│ └── src/
│ └── main/
│ └── kotlin/
│ ├── AuxBuildConfiguration.kt
│ ├── CacheRedirector.kt
│ ├── CommunityProjectsBuild.kt
│ ├── Dokka.kt
│ ├── GlobalKotlinCompilerOptions.kt
│ ├── Idea.kt
│ ├── Java9Modularity.kt
│ ├── Platform.kt
│ ├── Projects.kt
│ ├── Publishing.kt
│ ├── SourceSets.kt
│ ├── UnpackAar.kt
│ ├── VersionFile.kt
│ ├── animalsniffer-jvm-conventions.gradle.kts
│ ├── animalsniffer-multiplatform-conventions.gradle.kts
│ ├── bom-conventions.gradle.kts
│ ├── configure-compilation-conventions.gradle.kts
│ ├── dokka-conventions.gradle.kts
│ ├── java-modularity-conventions.gradle.kts
│ ├── knit-conventions.gradle.kts
│ ├── kotlin-jvm-conventions.gradle.kts
│ ├── kotlin-multiplatform-conventions.gradle.kts
│ ├── kover-conventions.gradle.kts
│ ├── pub-conventions.gradle.kts
│ ├── source-set-conventions.gradle.kts
│ └── version-file-conventions.gradle.kts
├── bump-version.sh
├── coroutines-guide.md
├── docs/
│ ├── basics.md
│ ├── cancellation-and-timeouts.md
│ ├── cfg/
│ │ └── buildprofiles.xml
│ ├── channels.md
│ ├── compatibility.md
│ ├── composing-suspending-functions.md
│ ├── coroutine-context-and-dispatchers.md
│ ├── coroutines-guide.md
│ ├── debugging.md
│ ├── exception-handling.md
│ ├── flow.md
│ ├── kc.tree
│ ├── knit.code.include
│ ├── knit.test.template
│ ├── select-expression.md
│ ├── shared-mutable-state-and-concurrency.md
│ ├── topics/
│ │ ├── cancellation-and-timeouts.md
│ │ ├── channels.md
│ │ ├── compatibility.md
│ │ ├── composing-suspending-functions.md
│ │ ├── coroutine-context-and-dispatchers.md
│ │ ├── coroutines-and-channels.md
│ │ ├── coroutines-basics.md
│ │ ├── coroutines-guide.md
│ │ ├── debug-coroutines-with-idea.md
│ │ ├── debug-flow-with-idea.md
│ │ ├── debugging.md
│ │ ├── exception-handling.md
│ │ ├── flow.md
│ │ ├── knit.properties
│ │ ├── select-expression.md
│ │ └── shared-mutable-state-and-concurrency.md
│ └── writerside.cfg
├── dokka-templates/
│ └── README.md
├── gradle/
│ └── wrapper/
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── integration/
│ ├── README.md
│ ├── kotlinx-coroutines-guava/
│ │ ├── README.md
│ │ ├── api/
│ │ │ └── kotlinx-coroutines-guava.api
│ │ ├── build.gradle.kts
│ │ ├── package.list
│ │ ├── src/
│ │ │ ├── ListenableFuture.kt
│ │ │ └── module-info.java
│ │ └── test/
│ │ ├── FutureAsDeferredUnhandledCompletionExceptionTest.kt
│ │ ├── ListenableFutureExceptionsTest.kt
│ │ ├── ListenableFutureTest.kt
│ │ └── ListenableFutureToStringTest.kt
│ ├── kotlinx-coroutines-jdk8/
│ │ ├── README.md
│ │ ├── api/
│ │ │ └── kotlinx-coroutines-jdk8.api
│ │ ├── build.gradle.kts
│ │ └── src/
│ │ └── module-info.java
│ ├── kotlinx-coroutines-play-services/
│ │ ├── README.md
│ │ ├── api/
│ │ │ └── kotlinx-coroutines-play-services.api
│ │ ├── build.gradle.kts
│ │ ├── package.list
│ │ ├── src/
│ │ │ └── Tasks.kt
│ │ └── test/
│ │ ├── FakeAndroid.kt
│ │ └── TaskTest.kt
│ └── kotlinx-coroutines-slf4j/
│ ├── README.md
│ ├── api/
│ │ └── kotlinx-coroutines-slf4j.api
│ ├── build.gradle.kts
│ ├── package.list
│ ├── src/
│ │ ├── MDCContext.kt
│ │ └── module-info.java
│ ├── test/
│ │ └── MDCContextTest.kt
│ └── test-resources/
│ └── logback-test.xml
├── integration-testing/
│ ├── .gitignore
│ ├── README.md
│ ├── build.gradle.kts
│ ├── gradle/
│ │ └── wrapper/
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── gradle.properties
│ ├── gradlew
│ ├── gradlew.bat
│ ├── java8Test/
│ │ ├── build.gradle.kts
│ │ └── src/
│ │ └── test/
│ │ └── kotlin/
│ │ └── JUnit5TimeoutCompilation.kt
│ ├── jpmsTest/
│ │ ├── build.gradle.kts
│ │ └── src/
│ │ └── debugDynamicAgentJpmsTest/
│ │ ├── java/
│ │ │ └── module-info.java
│ │ └── kotlin/
│ │ └── DynamicAttachDebugJpmsTest.kt
│ ├── settings.gradle.kts
│ ├── smokeTest/
│ │ ├── build.gradle.kts
│ │ └── src/
│ │ ├── commonMain/
│ │ │ └── kotlin/
│ │ │ └── Sample.kt
│ │ └── commonTest/
│ │ └── kotlin/
│ │ └── SampleTest.kt
│ └── src/
│ ├── coreAgentTest/
│ │ └── kotlin/
│ │ └── CoreAgentTest.kt
│ ├── debugAgentTest/
│ │ └── kotlin/
│ │ ├── DebugAgentTest.kt
│ │ ├── DebugProbes.kt
│ │ └── PrecompiledDebugProbesTest.kt
│ ├── debugDynamicAgentTest/
│ │ └── kotlin/
│ │ └── DynamicAttachDebugTest.kt
│ ├── jvmCoreTest/
│ │ └── kotlin/
│ │ ├── Jdk8InCoreIntegration.kt
│ │ └── ListAllCoroutineThrowableSubclassesTest.kt
│ └── mavenTest/
│ └── kotlin/
│ ├── MavenPublicationAtomicfuValidator.kt
│ ├── MavenPublicationMetaInfValidator.kt
│ └── MavenPublicationVersionValidator.kt
├── knit.properties
├── kotlinx-coroutines-bom/
│ └── build.gradle.kts
├── kotlinx-coroutines-core/
│ ├── README.md
│ ├── api/
│ │ ├── kotlinx-coroutines-core.api
│ │ └── kotlinx-coroutines-core.klib.api
│ ├── benchmarks/
│ │ ├── README.md
│ │ ├── jvm/
│ │ │ └── kotlin/
│ │ │ └── kotlinx/
│ │ │ └── coroutines/
│ │ │ ├── BenchmarkUtils.kt
│ │ │ ├── SemaphoreBenchmark.kt
│ │ │ ├── channels/
│ │ │ │ ├── ChannelProducerConsumerBenchmark.kt
│ │ │ │ ├── SelectBenchmark.kt
│ │ │ │ ├── SimpleChannel.kt
│ │ │ │ └── SimpleChannelBenchmark.kt
│ │ │ └── flow/
│ │ │ └── TakeWhileBenchmark.kt
│ │ └── main/
│ │ └── kotlin/
│ │ └── SharedFlowBaseline.kt
│ ├── build.gradle.kts
│ ├── common/
│ │ ├── README.md
│ │ ├── src/
│ │ │ ├── AbstractCoroutine.kt
│ │ │ ├── Annotations.kt
│ │ │ ├── Await.kt
│ │ │ ├── Builders.common.kt
│ │ │ ├── CancellableContinuation.kt
│ │ │ ├── CancellableContinuationImpl.kt
│ │ │ ├── CloseableCoroutineDispatcher.kt
│ │ │ ├── CompletableDeferred.kt
│ │ │ ├── CompletableJob.kt
│ │ │ ├── CompletionHandler.common.kt
│ │ │ ├── CompletionState.kt
│ │ │ ├── CoroutineContext.common.kt
│ │ │ ├── CoroutineDispatcher.kt
│ │ │ ├── CoroutineExceptionHandler.kt
│ │ │ ├── CoroutineName.kt
│ │ │ ├── CoroutineScope.kt
│ │ │ ├── CoroutineStart.kt
│ │ │ ├── Debug.common.kt
│ │ │ ├── Deferred.kt
│ │ │ ├── Delay.kt
│ │ │ ├── Dispatchers.common.kt
│ │ │ ├── EventLoop.common.kt
│ │ │ ├── Exceptions.common.kt
│ │ │ ├── Guidance.kt
│ │ │ ├── Job.kt
│ │ │ ├── JobSupport.kt
│ │ │ ├── MainCoroutineDispatcher.kt
│ │ │ ├── NonCancellable.kt
│ │ │ ├── Runnable.common.kt
│ │ │ ├── SchedulerTask.common.kt
│ │ │ ├── Supervisor.kt
│ │ │ ├── Timeout.kt
│ │ │ ├── Unconfined.kt
│ │ │ ├── Waiter.kt
│ │ │ ├── Yield.kt
│ │ │ ├── channels/
│ │ │ │ ├── Broadcast.kt
│ │ │ │ ├── BroadcastChannel.kt
│ │ │ │ ├── BufferOverflow.kt
│ │ │ │ ├── BufferedChannel.kt
│ │ │ │ ├── Channel.kt
│ │ │ │ ├── ChannelCoroutine.kt
│ │ │ │ ├── Channels.common.kt
│ │ │ │ ├── ConflatedBufferedChannel.kt
│ │ │ │ ├── Deprecated.kt
│ │ │ │ └── Produce.kt
│ │ │ ├── flow/
│ │ │ │ ├── Builders.kt
│ │ │ │ ├── Channels.kt
│ │ │ │ ├── Flow.kt
│ │ │ │ ├── FlowCollector.kt
│ │ │ │ ├── Migration.kt
│ │ │ │ ├── SharedFlow.kt
│ │ │ │ ├── SharingStarted.kt
│ │ │ │ ├── StateFlow.kt
│ │ │ │ ├── internal/
│ │ │ │ │ ├── AbstractSharedFlow.kt
│ │ │ │ │ ├── ChannelFlow.kt
│ │ │ │ │ ├── Combine.kt
│ │ │ │ │ ├── FlowCoroutine.kt
│ │ │ │ │ ├── FlowExceptions.common.kt
│ │ │ │ │ ├── Merge.kt
│ │ │ │ │ ├── NopCollector.kt
│ │ │ │ │ ├── NullSurrogate.kt
│ │ │ │ │ ├── SafeCollector.common.kt
│ │ │ │ │ └── SendingCollector.kt
│ │ │ │ ├── operators/
│ │ │ │ │ ├── Context.kt
│ │ │ │ │ ├── Delay.kt
│ │ │ │ │ ├── Distinct.kt
│ │ │ │ │ ├── Emitters.kt
│ │ │ │ │ ├── Errors.kt
│ │ │ │ │ ├── Limit.kt
│ │ │ │ │ ├── Lint.kt
│ │ │ │ │ ├── Merge.kt
│ │ │ │ │ ├── Share.kt
│ │ │ │ │ ├── Transform.kt
│ │ │ │ │ └── Zip.kt
│ │ │ │ └── terminal/
│ │ │ │ ├── Collect.kt
│ │ │ │ ├── Collection.kt
│ │ │ │ ├── Count.kt
│ │ │ │ ├── Logic.kt
│ │ │ │ └── Reduce.kt
│ │ │ ├── internal/
│ │ │ │ ├── Concurrent.common.kt
│ │ │ │ ├── ConcurrentLinkedList.kt
│ │ │ │ ├── CoroutineExceptionHandlerImpl.common.kt
│ │ │ │ ├── DispatchedContinuation.kt
│ │ │ │ ├── DispatchedTask.kt
│ │ │ │ ├── InlineList.kt
│ │ │ │ ├── InternalAnnotations.common.kt
│ │ │ │ ├── LimitedDispatcher.kt
│ │ │ │ ├── LocalAtomics.common.kt
│ │ │ │ ├── LockFreeLinkedList.common.kt
│ │ │ │ ├── LockFreeTaskQueue.kt
│ │ │ │ ├── MainDispatcherFactory.kt
│ │ │ │ ├── NamedDispatcher.kt
│ │ │ │ ├── OnUndeliveredElement.kt
│ │ │ │ ├── ProbesSupport.common.kt
│ │ │ │ ├── Scopes.kt
│ │ │ │ ├── StackTraceRecovery.common.kt
│ │ │ │ ├── Symbol.kt
│ │ │ │ ├── Synchronized.common.kt
│ │ │ │ ├── SystemProps.common.kt
│ │ │ │ ├── ThreadContext.common.kt
│ │ │ │ ├── ThreadLocal.common.kt
│ │ │ │ └── ThreadSafeHeap.kt
│ │ │ ├── intrinsics/
│ │ │ │ ├── Cancellable.kt
│ │ │ │ └── Undispatched.kt
│ │ │ ├── selects/
│ │ │ │ ├── OnTimeout.kt
│ │ │ │ ├── Select.kt
│ │ │ │ ├── SelectOld.kt
│ │ │ │ ├── SelectUnbiased.kt
│ │ │ │ └── WhileSelect.kt
│ │ │ └── sync/
│ │ │ ├── Mutex.kt
│ │ │ └── Semaphore.kt
│ │ └── test/
│ │ ├── AbstractCoroutineTest.kt
│ │ ├── AsyncLazyTest.kt
│ │ ├── AsyncTest.kt
│ │ ├── AtomicCancellationCommonTest.kt
│ │ ├── AwaitCancellationTest.kt
│ │ ├── AwaitTest.kt
│ │ ├── BuilderContractsTest.kt
│ │ ├── CancellableContinuationHandlersTest.kt
│ │ ├── CancellableContinuationTest.kt
│ │ ├── CancellableResumeOldTest.kt
│ │ ├── CancellableResumeTest.kt
│ │ ├── CancelledParentAttachTest.kt
│ │ ├── CompletableDeferredTest.kt
│ │ ├── CompletableJobTest.kt
│ │ ├── CoroutineDispatcherOperatorFunInvokeTest.kt
│ │ ├── CoroutineExceptionHandlerTest.kt
│ │ ├── CoroutineScopeTest.kt
│ │ ├── CoroutinesTest.kt
│ │ ├── DelayDurationTest.kt
│ │ ├── DelayTest.kt
│ │ ├── DispatchedContinuationTest.kt
│ │ ├── DurationToMillisTest.kt
│ │ ├── EmptyContext.kt
│ │ ├── FailedJobTest.kt
│ │ ├── ImmediateYieldTest.kt
│ │ ├── JobExtensionsTest.kt
│ │ ├── JobStatesTest.kt
│ │ ├── JobTest.kt
│ │ ├── LaunchLazyTest.kt
│ │ ├── LimitedParallelismSharedTest.kt
│ │ ├── NonCancellableTest.kt
│ │ ├── ParentCancellationTest.kt
│ │ ├── SupervisorTest.kt
│ │ ├── UnconfinedCancellationTest.kt
│ │ ├── UnconfinedTest.kt
│ │ ├── UndispatchedResultTest.kt
│ │ ├── WithContextTest.kt
│ │ ├── WithTimeoutDurationTest.kt
│ │ ├── WithTimeoutOrNullDurationTest.kt
│ │ ├── WithTimeoutOrNullTest.kt
│ │ ├── WithTimeoutTest.kt
│ │ ├── channels/
│ │ │ ├── BasicOperationsTest.kt
│ │ │ ├── BroadcastChannelFactoryTest.kt
│ │ │ ├── BroadcastTest.kt
│ │ │ ├── BufferedBroadcastChannelTest.kt
│ │ │ ├── BufferedChannelTest.kt
│ │ │ ├── ChannelBufferOverflowTest.kt
│ │ │ ├── ChannelFactoryTest.kt
│ │ │ ├── ChannelReceiveCatchingTest.kt
│ │ │ ├── ChannelUndeliveredElementFailureTest.kt
│ │ │ ├── ChannelUndeliveredElementTest.kt
│ │ │ ├── ChannelsTest.kt
│ │ │ ├── ConflatedBroadcastChannelTest.kt
│ │ │ ├── ConflatedChannelTest.kt
│ │ │ ├── ConsumeTest.kt
│ │ │ ├── ProduceConsumeTest.kt
│ │ │ ├── ProduceTest.kt
│ │ │ ├── RendezvousChannelTest.kt
│ │ │ ├── SendReceiveStressTest.kt
│ │ │ ├── TestBroadcastChannelKind.kt
│ │ │ ├── TestChannelKind.kt
│ │ │ └── UnlimitedChannelTest.kt
│ │ ├── flow/
│ │ │ ├── BuildersTest.kt
│ │ │ ├── FlowInvariantsTest.kt
│ │ │ ├── IdFlowTest.kt
│ │ │ ├── NamedDispatchers.kt
│ │ │ ├── SafeFlowTest.kt
│ │ │ ├── VirtualTime.kt
│ │ │ ├── channels/
│ │ │ │ ├── ChannelBuildersFlowTest.kt
│ │ │ │ ├── ChannelFlowTest.kt
│ │ │ │ └── FlowCallbackTest.kt
│ │ │ ├── internal/
│ │ │ │ └── FlowScopeTest.kt
│ │ │ ├── operators/
│ │ │ │ ├── BooleanTerminationTest.kt
│ │ │ │ ├── BufferConflationTest.kt
│ │ │ │ ├── BufferTest.kt
│ │ │ │ ├── CancellableTest.kt
│ │ │ │ ├── CatchTest.kt
│ │ │ │ ├── ChunkedTest.kt
│ │ │ │ ├── CombineParametersTest.kt
│ │ │ │ ├── CombineTest.kt
│ │ │ │ ├── ConflateTest.kt
│ │ │ │ ├── DebounceTest.kt
│ │ │ │ ├── DistinctUntilChangedTest.kt
│ │ │ │ ├── DropTest.kt
│ │ │ │ ├── DropWhileTest.kt
│ │ │ │ ├── FilterTest.kt
│ │ │ │ ├── FilterTrivialTest.kt
│ │ │ │ ├── FlatMapBaseTest.kt
│ │ │ │ ├── FlatMapConcatTest.kt
│ │ │ │ ├── FlatMapLatestTest.kt
│ │ │ │ ├── FlatMapMergeBaseTest.kt
│ │ │ │ ├── FlatMapMergeFastPathTest.kt
│ │ │ │ ├── FlatMapMergeTest.kt
│ │ │ │ ├── FlattenConcatTest.kt
│ │ │ │ ├── FlattenMergeTest.kt
│ │ │ │ ├── FlowContextOptimizationsTest.kt
│ │ │ │ ├── FlowOnTest.kt
│ │ │ │ ├── IndexedTest.kt
│ │ │ │ ├── LintTest.kt
│ │ │ │ ├── MapNotNullTest.kt
│ │ │ │ ├── MapTest.kt
│ │ │ │ ├── MergeTest.kt
│ │ │ │ ├── OnCompletionTest.kt
│ │ │ │ ├── OnEachTest.kt
│ │ │ │ ├── OnEmptyTest.kt
│ │ │ │ ├── OnStartTest.kt
│ │ │ │ ├── RetryTest.kt
│ │ │ │ ├── SampleTest.kt
│ │ │ │ ├── ScanTest.kt
│ │ │ │ ├── TakeTest.kt
│ │ │ │ ├── TakeWhileTest.kt
│ │ │ │ ├── TimeoutTest.kt
│ │ │ │ ├── TransformLatestTest.kt
│ │ │ │ ├── TransformTest.kt
│ │ │ │ ├── TransformWhileTest.kt
│ │ │ │ └── ZipTest.kt
│ │ │ ├── sharing/
│ │ │ │ ├── ShareInBufferTest.kt
│ │ │ │ ├── ShareInConflationTest.kt
│ │ │ │ ├── ShareInFusionTest.kt
│ │ │ │ ├── ShareInTest.kt
│ │ │ │ ├── SharedFlowScenarioTest.kt
│ │ │ │ ├── SharedFlowTest.kt
│ │ │ │ ├── SharingStartedTest.kt
│ │ │ │ ├── SharingStartedWhileSubscribedTest.kt
│ │ │ │ ├── StateFlowTest.kt
│ │ │ │ └── StateInTest.kt
│ │ │ └── terminal/
│ │ │ ├── CollectLatestTest.kt
│ │ │ ├── CountTest.kt
│ │ │ ├── FirstTest.kt
│ │ │ ├── FoldTest.kt
│ │ │ ├── LastTest.kt
│ │ │ ├── LaunchInTest.kt
│ │ │ ├── ReduceTest.kt
│ │ │ ├── SingleTest.kt
│ │ │ └── ToCollectionTest.kt
│ │ ├── selects/
│ │ │ ├── SelectBiasTest.kt
│ │ │ ├── SelectBufferedChannelTest.kt
│ │ │ ├── SelectDeferredTest.kt
│ │ │ ├── SelectJobTest.kt
│ │ │ ├── SelectLoopTest.kt
│ │ │ ├── SelectMutexTest.kt
│ │ │ ├── SelectOldTest.kt
│ │ │ ├── SelectRendezvousChannelTest.kt
│ │ │ ├── SelectTimeoutDurationTest.kt
│ │ │ ├── SelectTimeoutTest.kt
│ │ │ └── SelectUnlimitedChannelTest.kt
│ │ └── sync/
│ │ ├── MutexTest.kt
│ │ └── SemaphoreTest.kt
│ ├── concurrent/
│ │ ├── src/
│ │ │ ├── Builders.concurrent.kt
│ │ │ ├── Dispatchers.kt
│ │ │ ├── MultithreadedDispatchers.common.kt
│ │ │ ├── channels/
│ │ │ │ └── Channels.kt
│ │ │ └── internal/
│ │ │ ├── LockFreeLinkedList.kt
│ │ │ └── OnDemandAllocatingPool.kt
│ │ └── test/
│ │ ├── AbstractDispatcherConcurrencyTest.kt
│ │ ├── AtomicCancellationTest.kt
│ │ ├── CommonThreadLocalTest.kt
│ │ ├── ConcurrentExceptionsStressTest.kt
│ │ ├── ConcurrentTestUtilities.common.kt
│ │ ├── DefaultDispatchersConcurrencyTest.kt
│ │ ├── JobStructuredJoinStressTest.kt
│ │ ├── LimitedParallelismConcurrentTest.kt
│ │ ├── MultithreadedDispatcherStressTest.kt
│ │ ├── RunBlockingTest.kt
│ │ ├── channels/
│ │ │ ├── BroadcastChannelSubStressTest.kt
│ │ │ ├── ChannelCancelUndeliveredElementStressTest.kt
│ │ │ ├── ConflatedBroadcastChannelNotifyStressTest.kt
│ │ │ └── TrySendBlockingTest.kt
│ │ ├── flow/
│ │ │ ├── CombineStressTest.kt
│ │ │ ├── FlowCancellationTest.kt
│ │ │ ├── StateFlowCommonStressTest.kt
│ │ │ └── StateFlowUpdateCommonTest.kt
│ │ ├── selects/
│ │ │ ├── SelectChannelStressTest.kt
│ │ │ └── SelectMutexStressTest.kt
│ │ └── sync/
│ │ ├── MutexStressTest.kt
│ │ └── SemaphoreStressTest.kt
│ ├── js/
│ │ ├── src/
│ │ │ ├── CoroutineContext.kt
│ │ │ ├── Debug.kt
│ │ │ ├── JSDispatcher.kt
│ │ │ ├── Promise.kt
│ │ │ ├── Window.kt
│ │ │ └── internal/
│ │ │ ├── CopyOnWriteList.kt
│ │ │ └── CoroutineExceptionHandlerImpl.kt
│ │ └── test/
│ │ └── PromiseTest.kt
│ ├── jsAndWasmJsShared/
│ │ ├── src/
│ │ │ ├── EventLoop.kt
│ │ │ └── internal/
│ │ │ └── JSDispatcher.kt
│ │ └── test/
│ │ ├── MessageQueueTest.kt
│ │ └── SetTimeoutDispatcherTest.kt
│ ├── jsAndWasmShared/
│ │ ├── src/
│ │ │ ├── CloseableCoroutineDispatcher.kt
│ │ │ ├── CoroutineContext.kt
│ │ │ ├── Dispatchers.kt
│ │ │ ├── Exceptions.kt
│ │ │ ├── Runnable.kt
│ │ │ ├── SchedulerTask.kt
│ │ │ ├── flow/
│ │ │ │ └── internal/
│ │ │ │ ├── FlowExceptions.kt
│ │ │ │ └── SafeCollector.kt
│ │ │ └── internal/
│ │ │ ├── Concurrent.kt
│ │ │ ├── CoroutineExceptionHandlerImpl.kt
│ │ │ ├── LinkedList.kt
│ │ │ ├── LocalAtomics.kt
│ │ │ ├── ProbesSupport.kt
│ │ │ ├── StackTraceRecovery.kt
│ │ │ ├── Synchronized.kt
│ │ │ ├── SystemProps.kt
│ │ │ ├── ThreadContext.kt
│ │ │ └── ThreadLocal.kt
│ │ └── test/
│ │ ├── ImmediateDispatcherTest.kt
│ │ └── internal/
│ │ └── LinkedListTest.kt
│ ├── jvm/
│ │ ├── resources/
│ │ │ └── META-INF/
│ │ │ ├── com.android.tools/
│ │ │ │ ├── proguard/
│ │ │ │ │ └── coroutines.pro
│ │ │ │ └── r8/
│ │ │ │ └── coroutines.pro
│ │ │ └── proguard/
│ │ │ └── coroutines.pro
│ │ ├── src/
│ │ │ ├── AbstractTimeSource.kt
│ │ │ ├── Builders.kt
│ │ │ ├── CoroutineContext.kt
│ │ │ ├── Debug.kt
│ │ │ ├── DebugStrings.kt
│ │ │ ├── DefaultExecutor.kt
│ │ │ ├── Dispatchers.kt
│ │ │ ├── EventLoop.kt
│ │ │ ├── Exceptions.kt
│ │ │ ├── Executors.kt
│ │ │ ├── Future.kt
│ │ │ ├── Interruptible.kt
│ │ │ ├── Runnable.kt
│ │ │ ├── SchedulerTask.kt
│ │ │ ├── ThreadContextElement.kt
│ │ │ ├── ThreadPoolDispatcher.kt
│ │ │ ├── channels/
│ │ │ │ ├── Actor.kt
│ │ │ │ └── TickerChannels.kt
│ │ │ ├── debug/
│ │ │ │ ├── CoroutineDebugging.kt
│ │ │ │ └── internal/
│ │ │ │ ├── AgentInstallationType.kt
│ │ │ │ ├── AgentPremain.kt
│ │ │ │ ├── ConcurrentWeakMap.kt
│ │ │ │ ├── DebugCoroutineInfo.kt
│ │ │ │ ├── DebugCoroutineInfoImpl.kt
│ │ │ │ ├── DebugProbes.kt
│ │ │ │ ├── DebugProbesImpl.kt
│ │ │ │ ├── DebuggerInfo.kt
│ │ │ │ └── StackTraceFrame.kt
│ │ │ ├── flow/
│ │ │ │ └── internal/
│ │ │ │ ├── FlowExceptions.kt
│ │ │ │ └── SafeCollector.kt
│ │ │ ├── future/
│ │ │ │ └── Future.kt
│ │ │ ├── internal/
│ │ │ │ ├── Concurrent.kt
│ │ │ │ ├── CoroutineExceptionHandlerImpl.kt
│ │ │ │ ├── ExceptionsConstructor.kt
│ │ │ │ ├── FastServiceLoader.kt
│ │ │ │ ├── InternalAnnotations.kt
│ │ │ │ ├── LocalAtomics.kt
│ │ │ │ ├── MainDispatchers.kt
│ │ │ │ ├── ProbesSupport.kt
│ │ │ │ ├── ResizableAtomicArray.kt
│ │ │ │ ├── StackTraceRecovery.kt
│ │ │ │ ├── Synchronized.kt
│ │ │ │ ├── SystemProps.kt
│ │ │ │ ├── ThreadContext.kt
│ │ │ │ └── ThreadLocal.kt
│ │ │ ├── module-info.java
│ │ │ ├── scheduling/
│ │ │ │ ├── CoroutineScheduler.kt
│ │ │ │ ├── Dispatcher.kt
│ │ │ │ ├── Tasks.kt
│ │ │ │ └── WorkQueue.kt
│ │ │ ├── stream/
│ │ │ │ └── Stream.kt
│ │ │ └── time/
│ │ │ └── Time.kt
│ │ ├── test/
│ │ │ ├── AbstractLincheckTest.kt
│ │ │ ├── AsyncJvmTest.kt
│ │ │ ├── AwaitJvmTest.kt
│ │ │ ├── AwaitStressTest.kt
│ │ │ ├── CancellableContinuationJvmTest.kt
│ │ │ ├── CancellableContinuationResumeCloseStressTest.kt
│ │ │ ├── CancelledAwaitStressTest.kt
│ │ │ ├── ConcurrentTestUtilities.kt
│ │ │ ├── CoroutinesJvmTest.kt
│ │ │ ├── DebugThreadNameTest.kt
│ │ │ ├── DefaultExecutorStressTest.kt
│ │ │ ├── DelayJvmTest.kt
│ │ │ ├── DispatcherKeyTest.kt
│ │ │ ├── DispatchersToStringTest.kt
│ │ │ ├── EventLoopsTest.kt
│ │ │ ├── ExecutorAsCoroutineDispatcherDelayTest.kt
│ │ │ ├── ExecutorsTest.kt
│ │ │ ├── FailFastOnStartTest.kt
│ │ │ ├── FailingCoroutinesMachineryTest.kt
│ │ │ ├── IODispatcherTest.kt
│ │ │ ├── IntellijIdeaDebuggerEvaluatorCompatibilityTest.kt
│ │ │ ├── JobActivationStressTest.kt
│ │ │ ├── JobCancellationExceptionSerializerTest.kt
│ │ │ ├── JobChildStressTest.kt
│ │ │ ├── JobDisposeStressTest.kt
│ │ │ ├── JobHandlersUpgradeStressTest.kt
│ │ │ ├── JobOnCompletionStressTest.kt
│ │ │ ├── JobStressTest.kt
│ │ │ ├── JoinStressTest.kt
│ │ │ ├── LimitedParallelismStressTest.kt
│ │ │ ├── LimitedParallelismUnhandledExceptionTest.kt
│ │ │ ├── MemoryFootprintTest.kt
│ │ │ ├── MultithreadedDispatchersJvmTest.kt
│ │ │ ├── MutexCancellationStressTest.kt
│ │ │ ├── NoParamAssertionsTest.kt
│ │ │ ├── RejectedExecutionTest.kt
│ │ │ ├── ReusableCancellableContinuationInvariantStressTest.kt
│ │ │ ├── ReusableCancellableContinuationLeakStressTest.kt
│ │ │ ├── ReusableCancellableContinuationTest.kt
│ │ │ ├── ReusableContinuationStressTest.kt
│ │ │ ├── RunBlockingJvmTest.kt
│ │ │ ├── RunInterruptibleStressTest.kt
│ │ │ ├── RunInterruptibleTest.kt
│ │ │ ├── TestBaseTest.kt
│ │ │ ├── ThreadContextElementRestoreTest.kt
│ │ │ ├── ThreadContextElementTest.kt
│ │ │ ├── ThreadContextMutableCopiesTest.kt
│ │ │ ├── ThreadContextOrderTest.kt
│ │ │ ├── ThreadLocalStressTest.kt
│ │ │ ├── ThreadLocalTest.kt
│ │ │ ├── ThreadLocalsLeaksTest.kt
│ │ │ ├── UnconfinedConcurrentStressTest.kt
│ │ │ ├── VirtualTimeSource.kt
│ │ │ ├── WithDefaultContextTest.kt
│ │ │ ├── WithTimeoutChildDispatchStressTest.kt
│ │ │ ├── WithTimeoutOrNullJvmTest.kt
│ │ │ ├── WithTimeoutOrNullThreadDispatchTest.kt
│ │ │ ├── WithTimeoutThreadDispatchTest.kt
│ │ │ ├── channels/
│ │ │ │ ├── ActorLazyTest.kt
│ │ │ │ ├── ActorTest.kt
│ │ │ │ ├── BroadcastChannelLeakTest.kt
│ │ │ │ ├── BroadcastChannelMultiReceiveStressTest.kt
│ │ │ │ ├── BufferedChannelStressTest.kt
│ │ │ │ ├── CancelledChannelLeakTest.kt
│ │ │ │ ├── ChannelMemoryLeakStressTest.kt
│ │ │ │ ├── ChannelSelectStressTest.kt
│ │ │ │ ├── ChannelSendReceiveStressTest.kt
│ │ │ │ ├── ChannelUndeliveredElementSelectOldStressTest.kt
│ │ │ │ ├── ChannelUndeliveredElementStressTest.kt
│ │ │ │ ├── ConflatedChannelCloseStressTest.kt
│ │ │ │ ├── DoubleChannelCloseStressTest.kt
│ │ │ │ ├── InvokeOnCloseStressTest.kt
│ │ │ │ ├── ProduceConsumeJvmTest.kt
│ │ │ │ ├── SendReceiveJvmStressTest.kt
│ │ │ │ ├── SimpleSendReceiveJvmTest.kt
│ │ │ │ ├── TickerChannelCommonTest.kt
│ │ │ │ └── TickerChannelTest.kt
│ │ │ ├── examples/
│ │ │ │ ├── example-delay-01.kt
│ │ │ │ ├── example-delay-02.kt
│ │ │ │ ├── example-delay-03.kt
│ │ │ │ ├── example-delay-duration-01.kt
│ │ │ │ ├── example-delay-duration-02.kt
│ │ │ │ ├── example-delay-duration-03.kt
│ │ │ │ ├── example-timeout-duration-01.kt
│ │ │ │ └── test/
│ │ │ │ └── FlowDelayTest.kt
│ │ │ ├── exceptions/
│ │ │ │ ├── CoroutineExceptionHandlerJvmTest.kt
│ │ │ │ ├── FlowSuppressionTest.kt
│ │ │ │ ├── JobBasicCancellationTest.kt
│ │ │ │ ├── JobExceptionHandlingTest.kt
│ │ │ │ ├── JobExceptionsStressTest.kt
│ │ │ │ ├── JobNestedExceptionsTest.kt
│ │ │ │ ├── ProduceExceptionsTest.kt
│ │ │ │ ├── StackTraceRecoveryChannelsTest.kt
│ │ │ │ ├── StackTraceRecoveryCustomExceptionsTest.kt
│ │ │ │ ├── StackTraceRecoveryNestedScopesTest.kt
│ │ │ │ ├── StackTraceRecoveryNestedTest.kt
│ │ │ │ ├── StackTraceRecoveryResumeModeTest.kt
│ │ │ │ ├── StackTraceRecoverySelectTest.kt
│ │ │ │ ├── StackTraceRecoveryTest.kt
│ │ │ │ ├── StackTraceRecoveryWithTimeoutTest.kt
│ │ │ │ ├── Stacktraces.kt
│ │ │ │ ├── SuppressionTests.kt
│ │ │ │ ├── WithContextCancellationStressTest.kt
│ │ │ │ └── WithContextExceptionHandlingTest.kt
│ │ │ ├── flow/
│ │ │ │ ├── CallbackFlowTest.kt
│ │ │ │ ├── ExceptionTransparencyTest.kt
│ │ │ │ ├── FirstJvmTest.kt
│ │ │ │ ├── FlatMapStressTest.kt
│ │ │ │ ├── OnCompletionInterceptedReleaseTest.kt
│ │ │ │ ├── SafeCollectorMemoryLeakTest.kt
│ │ │ │ ├── SharedFlowStressTest.kt
│ │ │ │ ├── SharingReferenceTest.kt
│ │ │ │ ├── SharingStressTest.kt
│ │ │ │ ├── StateFlowCancellabilityTest.kt
│ │ │ │ ├── StateFlowStressTest.kt
│ │ │ │ └── StateFlowUpdateStressTest.kt
│ │ │ ├── guide/
│ │ │ │ ├── example-basic-01.kt
│ │ │ │ ├── example-basic-02.kt
│ │ │ │ ├── example-basic-03.kt
│ │ │ │ ├── example-basic-04.kt
│ │ │ │ ├── example-basic-05.kt
│ │ │ │ ├── example-basic-06.kt
│ │ │ │ ├── example-cancel-01.kt
│ │ │ │ ├── example-cancel-02.kt
│ │ │ │ ├── example-cancel-03.kt
│ │ │ │ ├── example-cancel-04.kt
│ │ │ │ ├── example-cancel-05.kt
│ │ │ │ ├── example-cancel-06.kt
│ │ │ │ ├── example-cancel-07.kt
│ │ │ │ ├── example-cancel-08.kt
│ │ │ │ ├── example-cancel-09.kt
│ │ │ │ ├── example-cancel-10.kt
│ │ │ │ ├── example-channel-01.kt
│ │ │ │ ├── example-channel-02.kt
│ │ │ │ ├── example-channel-03.kt
│ │ │ │ ├── example-channel-04.kt
│ │ │ │ ├── example-channel-05.kt
│ │ │ │ ├── example-channel-06.kt
│ │ │ │ ├── example-channel-07.kt
│ │ │ │ ├── example-channel-08.kt
│ │ │ │ ├── example-channel-09.kt
│ │ │ │ ├── example-channel-10.kt
│ │ │ │ ├── example-compose-01.kt
│ │ │ │ ├── example-compose-02.kt
│ │ │ │ ├── example-compose-03.kt
│ │ │ │ ├── example-compose-04.kt
│ │ │ │ ├── example-compose-05.kt
│ │ │ │ ├── example-compose-06.kt
│ │ │ │ ├── example-context-01.kt
│ │ │ │ ├── example-context-02.kt
│ │ │ │ ├── example-context-03.kt
│ │ │ │ ├── example-context-04.kt
│ │ │ │ ├── example-context-05.kt
│ │ │ │ ├── example-context-06.kt
│ │ │ │ ├── example-context-07.kt
│ │ │ │ ├── example-context-08.kt
│ │ │ │ ├── example-context-09.kt
│ │ │ │ ├── example-context-10.kt
│ │ │ │ ├── example-context-11.kt
│ │ │ │ ├── example-exceptions-01.kt
│ │ │ │ ├── example-exceptions-02.kt
│ │ │ │ ├── example-exceptions-03.kt
│ │ │ │ ├── example-exceptions-04.kt
│ │ │ │ ├── example-exceptions-05.kt
│ │ │ │ ├── example-exceptions-06.kt
│ │ │ │ ├── example-flow-01.kt
│ │ │ │ ├── example-flow-02.kt
│ │ │ │ ├── example-flow-03.kt
│ │ │ │ ├── example-flow-04.kt
│ │ │ │ ├── example-flow-05.kt
│ │ │ │ ├── example-flow-06.kt
│ │ │ │ ├── example-flow-07.kt
│ │ │ │ ├── example-flow-08.kt
│ │ │ │ ├── example-flow-09.kt
│ │ │ │ ├── example-flow-10.kt
│ │ │ │ ├── example-flow-11.kt
│ │ │ │ ├── example-flow-12.kt
│ │ │ │ ├── example-flow-13.kt
│ │ │ │ ├── example-flow-14.kt
│ │ │ │ ├── example-flow-15.kt
│ │ │ │ ├── example-flow-16.kt
│ │ │ │ ├── example-flow-17.kt
│ │ │ │ ├── example-flow-18.kt
│ │ │ │ ├── example-flow-19.kt
│ │ │ │ ├── example-flow-20.kt
│ │ │ │ ├── example-flow-21.kt
│ │ │ │ ├── example-flow-22.kt
│ │ │ │ ├── example-flow-23.kt
│ │ │ │ ├── example-flow-24.kt
│ │ │ │ ├── example-flow-25.kt
│ │ │ │ ├── example-flow-26.kt
│ │ │ │ ├── example-flow-27.kt
│ │ │ │ ├── example-flow-28.kt
│ │ │ │ ├── example-flow-29.kt
│ │ │ │ ├── example-flow-30.kt
│ │ │ │ ├── example-flow-31.kt
│ │ │ │ ├── example-flow-32.kt
│ │ │ │ ├── example-flow-33.kt
│ │ │ │ ├── example-flow-34.kt
│ │ │ │ ├── example-flow-35.kt
│ │ │ │ ├── example-flow-36.kt
│ │ │ │ ├── example-flow-37.kt
│ │ │ │ ├── example-flow-38.kt
│ │ │ │ ├── example-flow-39.kt
│ │ │ │ ├── example-select-01.kt
│ │ │ │ ├── example-select-02.kt
│ │ │ │ ├── example-select-03.kt
│ │ │ │ ├── example-select-04.kt
│ │ │ │ ├── example-select-05.kt
│ │ │ │ ├── example-supervision-01.kt
│ │ │ │ ├── example-supervision-02.kt
│ │ │ │ ├── example-supervision-03.kt
│ │ │ │ ├── example-sync-01.kt
│ │ │ │ ├── example-sync-02.kt
│ │ │ │ ├── example-sync-03.kt
│ │ │ │ ├── example-sync-04.kt
│ │ │ │ ├── example-sync-05.kt
│ │ │ │ ├── example-sync-06.kt
│ │ │ │ ├── example-sync-07.kt
│ │ │ │ └── test/
│ │ │ │ ├── BasicsGuideTest.kt
│ │ │ │ ├── CancellationGuideTest.kt
│ │ │ │ ├── ChannelsGuideTest.kt
│ │ │ │ ├── ComposingGuideTest.kt
│ │ │ │ ├── DispatcherGuideTest.kt
│ │ │ │ ├── ExceptionsGuideTest.kt
│ │ │ │ ├── FlowGuideTest.kt
│ │ │ │ ├── SelectGuideTest.kt
│ │ │ │ └── SharedStateGuideTest.kt
│ │ │ ├── internal/
│ │ │ │ ├── ConcurrentWeakMapCollectionStressTest.kt
│ │ │ │ ├── ConcurrentWeakMapOperationStressTest.kt
│ │ │ │ ├── ConcurrentWeakMapTest.kt
│ │ │ │ ├── FastServiceLoaderTest.kt
│ │ │ │ ├── LockFreeLinkedListLongStressTest.kt
│ │ │ │ ├── LockFreeTaskQueueStressTest.kt
│ │ │ │ ├── LockFreeTaskQueueTest.kt
│ │ │ │ ├── OnDemandAllocatingPoolLincheckTest.kt
│ │ │ │ ├── ThreadSafeHeapStressTest.kt
│ │ │ │ └── ThreadSafeHeapTest.kt
│ │ │ ├── jdk8/
│ │ │ │ ├── future/
│ │ │ │ │ ├── AsFutureTest.kt
│ │ │ │ │ ├── FutureAsDeferredUnhandledCompletionExceptionTest.kt
│ │ │ │ │ ├── FutureExceptionsTest.kt
│ │ │ │ │ └── FutureTest.kt
│ │ │ │ ├── stream/
│ │ │ │ │ └── ConsumeAsFlowTest.kt
│ │ │ │ └── time/
│ │ │ │ ├── DurationOverflowTest.kt
│ │ │ │ ├── FlowDebounceTest.kt
│ │ │ │ ├── FlowSampleTest.kt
│ │ │ │ └── WithTimeoutTest.kt
│ │ │ ├── knit/
│ │ │ │ ├── ClosedAfterGuideTestExecutor.kt
│ │ │ │ └── TestUtil.kt
│ │ │ ├── lincheck/
│ │ │ │ ├── ChannelsLincheckTest.kt
│ │ │ │ ├── LockFreeTaskQueueLincheckTest.kt
│ │ │ │ ├── MutexLincheckTest.kt
│ │ │ │ ├── ResizableAtomicArrayLincheckTest.kt
│ │ │ │ └── SemaphoreLincheckTest.kt
│ │ │ ├── scheduling/
│ │ │ │ ├── BlockingCoroutineDispatcherLivenessStressTest.kt
│ │ │ │ ├── BlockingCoroutineDispatcherMixedStealingStressTest.kt
│ │ │ │ ├── BlockingCoroutineDispatcherTerminationStressTest.kt
│ │ │ │ ├── BlockingCoroutineDispatcherTest.kt
│ │ │ │ ├── BlockingCoroutineDispatcherThreadLimitStressTest.kt
│ │ │ │ ├── BlockingCoroutineDispatcherWorkSignallingStressTest.kt
│ │ │ │ ├── CoroutineDispatcherTest.kt
│ │ │ │ ├── CoroutineSchedulerCloseStressTest.kt
│ │ │ │ ├── CoroutineSchedulerInternalApiStressTest.kt
│ │ │ │ ├── CoroutineSchedulerLivenessStressTest.kt
│ │ │ │ ├── CoroutineSchedulerOversubscriptionTest.kt
│ │ │ │ ├── CoroutineSchedulerStressTest.kt
│ │ │ │ ├── CoroutineSchedulerTest.kt
│ │ │ │ ├── DefaultDispatchersTest.kt
│ │ │ │ ├── LimitingCoroutineDispatcherStressTest.kt
│ │ │ │ ├── LimitingDispatcherTest.kt
│ │ │ │ ├── SchedulerTestBase.kt
│ │ │ │ ├── SharingWorkerClassTest.kt
│ │ │ │ ├── TestTimeSource.kt
│ │ │ │ ├── WorkQueueStressTest.kt
│ │ │ │ └── WorkQueueTest.kt
│ │ │ └── selects/
│ │ │ ├── SelectDeadlockStressTest.kt
│ │ │ ├── SelectMemoryLeakStressTest.kt
│ │ │ └── SelectPhilosophersStressTest.kt
│ │ └── test-resources/
│ │ └── stacktraces/
│ │ ├── channels/
│ │ │ ├── testOfferFromScope.txt
│ │ │ ├── testOfferWithContextWrapped.txt
│ │ │ ├── testOfferWithCurrentContext.txt
│ │ │ ├── testReceiveFromChannel.txt
│ │ │ ├── testReceiveFromClosedChannel.txt
│ │ │ ├── testSendFromScope.txt
│ │ │ ├── testSendToChannel.txt
│ │ │ └── testSendToClosedChannel.txt
│ │ ├── resume-mode/
│ │ │ ├── testEventLoopDispatcher.txt
│ │ │ ├── testEventLoopDispatcherSuspending.txt
│ │ │ ├── testNestedEventLoopChangedContext.txt
│ │ │ ├── testNestedEventLoopChangedContextSuspending.txt
│ │ │ ├── testNestedEventLoopDispatcher.txt
│ │ │ ├── testNestedEventLoopDispatcherSuspending.txt
│ │ │ ├── testNestedUnconfined.txt
│ │ │ ├── testNestedUnconfinedChangedContext.txt
│ │ │ ├── testNestedUnconfinedChangedContextSuspending.txt
│ │ │ ├── testNestedUnconfinedSuspending.txt
│ │ │ ├── testUnconfined.txt
│ │ │ └── testUnconfinedSuspending.txt
│ │ ├── select/
│ │ │ ├── testSelectCompletedAwait.txt
│ │ │ ├── testSelectJoin.txt
│ │ │ └── testSelectOnReceive.txt
│ │ └── timeout/
│ │ ├── testStacktraceIsRecoveredFromLexicalBlockWhenTriggeredByChild.txt
│ │ ├── testStacktraceIsRecoveredFromSuspensionPoint.txt
│ │ └── testStacktraceIsRecoveredFromSuspensionPointWithChild.txt
│ ├── knit.properties
│ ├── native/
│ │ ├── src/
│ │ │ ├── Builders.kt
│ │ │ ├── CloseableCoroutineDispatcher.kt
│ │ │ ├── CoroutineContext.kt
│ │ │ ├── Debug.kt
│ │ │ ├── Dispatchers.kt
│ │ │ ├── EventLoop.kt
│ │ │ ├── Exceptions.kt
│ │ │ ├── MultithreadedDispatchers.kt
│ │ │ ├── Runnable.kt
│ │ │ ├── SchedulerTask.kt
│ │ │ ├── flow/
│ │ │ │ └── internal/
│ │ │ │ ├── FlowExceptions.kt
│ │ │ │ └── SafeCollector.kt
│ │ │ └── internal/
│ │ │ ├── Concurrent.kt
│ │ │ ├── CopyOnWriteList.kt
│ │ │ ├── CoroutineExceptionHandlerImpl.kt
│ │ │ ├── LocalAtomics.kt
│ │ │ ├── ProbesSupport.kt
│ │ │ ├── StackTraceRecovery.kt
│ │ │ ├── Synchronized.kt
│ │ │ ├── SystemProps.kt
│ │ │ ├── ThreadContext.kt
│ │ │ └── ThreadLocal.kt
│ │ └── test/
│ │ ├── ConcurrentTestUtilities.kt
│ │ ├── DelayExceptionTest.kt
│ │ ├── MultithreadedDispatchersTest.kt
│ │ └── WorkerTest.kt
│ ├── nativeDarwin/
│ │ ├── src/
│ │ │ └── Dispatchers.kt
│ │ └── test/
│ │ ├── Launcher.kt
│ │ └── MainDispatcherTest.kt
│ ├── nativeOther/
│ │ ├── src/
│ │ │ └── Dispatchers.kt
│ │ └── test/
│ │ └── Launcher.kt
│ ├── wasmJs/
│ │ ├── src/
│ │ │ ├── CoroutineContext.kt
│ │ │ ├── Debug.kt
│ │ │ ├── JSDispatcher.kt
│ │ │ ├── Promise.kt
│ │ │ └── internal/
│ │ │ ├── CopyOnWriteList.kt
│ │ │ └── CoroutineExceptionHandlerImpl.kt
│ │ └── test/
│ │ └── PromiseTest.kt
│ └── wasmWasi/
│ └── src/
│ ├── Debug.kt
│ ├── EventLoop.kt
│ └── internal/
│ ├── CoroutineExceptionHandlerImpl.kt
│ └── CoroutineRunner.kt
├── kotlinx-coroutines-debug/
│ ├── README.md
│ ├── api/
│ │ └── kotlinx-coroutines-debug.api
│ ├── build.gradle.kts
│ ├── resources/
│ │ └── META-INF/
│ │ └── services/
│ │ └── reactor.blockhound.integration.BlockHoundIntegration
│ ├── src/
│ │ ├── Attach.kt
│ │ ├── CoroutineInfo.kt
│ │ ├── CoroutinesBlockHoundIntegration.kt
│ │ ├── DebugProbes.kt
│ │ ├── NoOpProbes.kt
│ │ ├── junit/
│ │ │ ├── CoroutinesTimeoutImpl.kt
│ │ │ ├── junit4/
│ │ │ │ ├── CoroutinesTimeout.kt
│ │ │ │ └── CoroutinesTimeoutStatement.kt
│ │ │ └── junit5/
│ │ │ ├── CoroutinesTimeout.kt
│ │ │ └── CoroutinesTimeoutExtension.kt
│ │ └── module-info.java
│ └── test/
│ ├── BlockHoundTest.kt
│ ├── CoroutinesDumpTest.kt
│ ├── DebugLeaksTest.kt
│ ├── DebugProbesTest.kt
│ ├── DebugTestBase.kt
│ ├── DumpCoroutineInfoAsJsonAndReferencesTest.kt
│ ├── DumpWithCreationStackTraceTest.kt
│ ├── EnhanceStackTraceWithTreadDumpAsJsonTest.kt
│ ├── Example.kt
│ ├── LazyCoroutineTest.kt
│ ├── RecoveryExample.kt
│ ├── RunningThreadStackMergeTest.kt
│ ├── SanitizedProbesTest.kt
│ ├── ScopedBuildersTest.kt
│ ├── StacktraceUtils.kt
│ ├── StandardBuildersDebugTest.kt
│ ├── StartModeProbesTest.kt
│ ├── TestRuleExample.kt
│ ├── ToStringTest.kt
│ ├── WithContextUndispatchedTest.kt
│ ├── junit4/
│ │ ├── CoroutinesTimeoutDisabledTracesTest.kt
│ │ ├── CoroutinesTimeoutEagerTest.kt
│ │ ├── CoroutinesTimeoutTest.kt
│ │ └── TestFailureValidation.kt
│ └── junit5/
│ ├── CoroutinesTimeoutExtensionTest.kt
│ ├── CoroutinesTimeoutInheritanceTest.kt
│ ├── CoroutinesTimeoutMethodTest.kt
│ ├── CoroutinesTimeoutNestedTest.kt
│ ├── CoroutinesTimeoutSimpleTest.kt
│ ├── CoroutinesTimeoutTest.kt
│ └── RegisterExtensionExample.kt
├── kotlinx-coroutines-test/
│ ├── MIGRATION.md
│ ├── README.md
│ ├── api/
│ │ ├── kotlinx-coroutines-test.api
│ │ └── kotlinx-coroutines-test.klib.api
│ ├── build.gradle.kts
│ ├── common/
│ │ ├── src/
│ │ │ ├── TestBuilders.kt
│ │ │ ├── TestCoroutineDispatchers.kt
│ │ │ ├── TestCoroutineScheduler.kt
│ │ │ ├── TestDispatcher.kt
│ │ │ ├── TestDispatchers.kt
│ │ │ ├── TestScope.kt
│ │ │ └── internal/
│ │ │ ├── ExceptionCollector.kt
│ │ │ ├── ReportingSupervisorJob.kt
│ │ │ └── TestMainDispatcher.kt
│ │ └── test/
│ │ ├── Helpers.kt
│ │ ├── RunTestTest.kt
│ │ ├── StandardTestDispatcherTest.kt
│ │ ├── TestCoroutineSchedulerTest.kt
│ │ ├── TestDispatchersTest.kt
│ │ ├── TestScopeTest.kt
│ │ └── UnconfinedTestDispatcherTest.kt
│ ├── js/
│ │ ├── src/
│ │ │ ├── TestBuilders.kt
│ │ │ └── internal/
│ │ │ ├── JsPromiseInterfaceForTesting.kt
│ │ │ └── TestMainDispatcher.kt
│ │ └── test/
│ │ ├── Helpers.kt
│ │ └── PromiseTest.kt
│ ├── jvm/
│ │ ├── resources/
│ │ │ └── META-INF/
│ │ │ ├── proguard/
│ │ │ │ └── coroutines.pro
│ │ │ └── services/
│ │ │ ├── kotlinx.coroutines.CoroutineExceptionHandler
│ │ │ └── kotlinx.coroutines.internal.MainDispatcherFactory
│ │ ├── src/
│ │ │ ├── TestBuildersJvm.kt
│ │ │ ├── internal/
│ │ │ │ └── TestMainDispatcherJvm.kt
│ │ │ ├── migration/
│ │ │ │ ├── TestBuildersDeprecated.kt
│ │ │ │ ├── TestCoroutineDispatcher.kt
│ │ │ │ ├── TestCoroutineExceptionHandler.kt
│ │ │ │ └── TestCoroutineScope.kt
│ │ │ └── module-info.java
│ │ └── test/
│ │ ├── DumpOnTimeoutTest.kt
│ │ ├── HelpersJvm.kt
│ │ ├── MemoryLeakTest.kt
│ │ ├── MultithreadingTest.kt
│ │ ├── RunTestStressTest.kt
│ │ ├── UncaughtExceptionsTest.kt
│ │ └── migration/
│ │ ├── RunBlockingTestOnTestScopeTest.kt
│ │ ├── RunTestLegacyScopeTest.kt
│ │ ├── TestBuildersTest.kt
│ │ ├── TestCoroutineDispatcherTest.kt
│ │ ├── TestCoroutineScopeTest.kt
│ │ ├── TestRunBlockingOrderTest.kt
│ │ └── TestRunBlockingTest.kt
│ ├── native/
│ │ ├── src/
│ │ │ ├── TestBuilders.kt
│ │ │ └── internal/
│ │ │ └── TestMainDispatcher.kt
│ │ └── test/
│ │ └── Helpers.kt
│ ├── npm/
│ │ ├── README.md
│ │ └── package.json
│ ├── wasmJs/
│ │ ├── src/
│ │ │ ├── TestBuilders.kt
│ │ │ └── internal/
│ │ │ ├── JsPromiseInterfaceForTesting.kt
│ │ │ └── TestMainDispatcher.kt
│ │ └── test/
│ │ ├── Helpers.kt
│ │ └── PromiseTest.kt
│ └── wasmWasi/
│ ├── src/
│ │ ├── TestBuilders.kt
│ │ └── internal/
│ │ └── TestMainDispatcher.kt
│ └── test/
│ └── Helpers.kt
├── license/
│ └── NOTICE.txt
├── reactive/
│ ├── README.md
│ ├── knit.properties
│ ├── knit.test.include
│ ├── kotlinx-coroutines-jdk9/
│ │ ├── README.md
│ │ ├── api/
│ │ │ └── kotlinx-coroutines-jdk9.api
│ │ ├── build.gradle.kts
│ │ ├── package.list
│ │ ├── src/
│ │ │ ├── Await.kt
│ │ │ ├── Publish.kt
│ │ │ ├── ReactiveFlow.kt
│ │ │ └── module-info.java
│ │ └── test/
│ │ ├── AwaitTest.kt
│ │ ├── FlowAsPublisherTest.kt
│ │ ├── IntegrationTest.kt
│ │ ├── PublishTest.kt
│ │ ├── PublisherAsFlowTest.kt
│ │ ├── PublisherBackpressureTest.kt
│ │ ├── PublisherCollectTest.kt
│ │ ├── PublisherCompletionStressTest.kt
│ │ └── PublisherMultiTest.kt
│ ├── kotlinx-coroutines-reactive/
│ │ ├── README.md
│ │ ├── api/
│ │ │ └── kotlinx-coroutines-reactive.api
│ │ ├── build.gradle.kts
│ │ ├── package.list
│ │ ├── src/
│ │ │ ├── Await.kt
│ │ │ ├── Channel.kt
│ │ │ ├── ContextInjector.kt
│ │ │ ├── Convert.kt
│ │ │ ├── Migration.kt
│ │ │ ├── Publish.kt
│ │ │ ├── ReactiveFlow.kt
│ │ │ └── module-info.java
│ │ └── test/
│ │ ├── AwaitCancellationStressTest.kt
│ │ ├── AwaitTest.kt
│ │ ├── CancelledParentAttachTest.kt
│ │ ├── FlowAsPublisherTest.kt
│ │ ├── IntegrationTest.kt
│ │ ├── IterableFlowTckTest.kt
│ │ ├── PublishTest.kt
│ │ ├── PublisherAsFlowTest.kt
│ │ ├── PublisherBackpressureTest.kt
│ │ ├── PublisherCollectTest.kt
│ │ ├── PublisherCompletionStressTest.kt
│ │ ├── PublisherMultiTest.kt
│ │ ├── PublisherRequestStressTest.kt
│ │ ├── PublisherSubscriptionSelectTest.kt
│ │ ├── RangePublisherBufferedTest.kt
│ │ ├── RangePublisherTest.kt
│ │ ├── ReactiveStreamTckTest.kt
│ │ └── UnboundedIntegerIncrementPublisherTest.kt
│ ├── kotlinx-coroutines-reactor/
│ │ ├── README.md
│ │ ├── api/
│ │ │ └── kotlinx-coroutines-reactor.api
│ │ ├── build.gradle.kts
│ │ ├── package.list
│ │ ├── resources/
│ │ │ └── META-INF/
│ │ │ └── services/
│ │ │ └── kotlinx.coroutines.reactive.ContextInjector
│ │ ├── src/
│ │ │ ├── Convert.kt
│ │ │ ├── Flux.kt
│ │ │ ├── Migration.kt
│ │ │ ├── Mono.kt
│ │ │ ├── ReactorContext.kt
│ │ │ ├── ReactorContextInjector.kt
│ │ │ ├── ReactorFlow.kt
│ │ │ ├── Scheduler.kt
│ │ │ └── module-info.java
│ │ └── test/
│ │ ├── BackpressureTest.kt
│ │ ├── Check.kt
│ │ ├── ConvertTest.kt
│ │ ├── FlowAsFluxTest.kt
│ │ ├── FluxCompletionStressTest.kt
│ │ ├── FluxContextTest.kt
│ │ ├── FluxMultiTest.kt
│ │ ├── FluxSingleTest.kt
│ │ ├── FluxTest.kt
│ │ ├── MonoAwaitStressTest.kt
│ │ ├── MonoTest.kt
│ │ ├── ReactorContextTest.kt
│ │ └── SchedulerTest.kt
│ ├── kotlinx-coroutines-rx2/
│ │ ├── README.md
│ │ ├── api/
│ │ │ └── kotlinx-coroutines-rx2.api
│ │ ├── build.gradle.kts
│ │ ├── package.list
│ │ ├── src/
│ │ │ ├── RxAwait.kt
│ │ │ ├── RxCancellable.kt
│ │ │ ├── RxChannel.kt
│ │ │ ├── RxCompletable.kt
│ │ │ ├── RxConvert.kt
│ │ │ ├── RxFlowable.kt
│ │ │ ├── RxMaybe.kt
│ │ │ ├── RxObservable.kt
│ │ │ ├── RxScheduler.kt
│ │ │ ├── RxSingle.kt
│ │ │ └── module-info.java
│ │ └── test/
│ │ ├── BackpressureTest.kt
│ │ ├── Check.kt
│ │ ├── CompletableTest.kt
│ │ ├── ConvertTest.kt
│ │ ├── FlowAsFlowableTest.kt
│ │ ├── FlowAsObservableTest.kt
│ │ ├── FlowableContextTest.kt
│ │ ├── FlowableExceptionHandlingTest.kt
│ │ ├── FlowableTest.kt
│ │ ├── IntegrationTest.kt
│ │ ├── IterableFlowAsFlowableTckTest.kt
│ │ ├── LeakedExceptionTest.kt
│ │ ├── MaybeTest.kt
│ │ ├── ObservableAsFlowTest.kt
│ │ ├── ObservableCollectTest.kt
│ │ ├── ObservableCompletionStressTest.kt
│ │ ├── ObservableExceptionHandlingTest.kt
│ │ ├── ObservableMultiTest.kt
│ │ ├── ObservableSingleTest.kt
│ │ ├── ObservableSourceAsFlowStressTest.kt
│ │ ├── ObservableSubscriptionSelectTest.kt
│ │ ├── ObservableTest.kt
│ │ ├── SchedulerStressTest.kt
│ │ ├── SchedulerTest.kt
│ │ └── SingleTest.kt
│ └── kotlinx-coroutines-rx3/
│ ├── README.md
│ ├── api/
│ │ └── kotlinx-coroutines-rx3.api
│ ├── build.gradle.kts
│ ├── package.list
│ ├── src/
│ │ ├── RxAwait.kt
│ │ ├── RxCancellable.kt
│ │ ├── RxChannel.kt
│ │ ├── RxCompletable.kt
│ │ ├── RxConvert.kt
│ │ ├── RxFlowable.kt
│ │ ├── RxMaybe.kt
│ │ ├── RxObservable.kt
│ │ ├── RxScheduler.kt
│ │ ├── RxSingle.kt
│ │ └── module-info.java
│ └── test/
│ ├── BackpressureTest.kt
│ ├── Check.kt
│ ├── CompletableTest.kt
│ ├── ConvertTest.kt
│ ├── FlowAsFlowableTest.kt
│ ├── FlowAsObservableTest.kt
│ ├── FlowableContextTest.kt
│ ├── FlowableExceptionHandlingTest.kt
│ ├── FlowableTest.kt
│ ├── IntegrationTest.kt
│ ├── IterableFlowAsFlowableTckTest.kt
│ ├── LeakedExceptionTest.kt
│ ├── MaybeTest.kt
│ ├── ObservableAsFlowTest.kt
│ ├── ObservableCollectTest.kt
│ ├── ObservableCompletionStressTest.kt
│ ├── ObservableExceptionHandlingTest.kt
│ ├── ObservableMultiTest.kt
│ ├── ObservableSingleTest.kt
│ ├── ObservableSourceAsFlowStressTest.kt
│ ├── ObservableSubscriptionSelectTest.kt
│ ├── ObservableTest.kt
│ ├── SchedulerStressTest.kt
│ ├── SchedulerTest.kt
│ └── SingleTest.kt
├── settings.gradle.kts
├── site/
│ └── stdlib.package.list
├── test-utils/
│ ├── build.gradle.kts
│ ├── common/
│ │ └── src/
│ │ ├── LaunchFlow.kt
│ │ ├── MainDispatcherTestBase.kt
│ │ └── TestBase.common.kt
│ ├── js/
│ │ └── src/
│ │ └── TestBase.kt
│ ├── jvm/
│ │ └── src/
│ │ ├── Exceptions.kt
│ │ ├── ExecutorRule.kt
│ │ ├── FieldWalker.kt
│ │ ├── TestBase.kt
│ │ └── Threads.kt
│ ├── native/
│ │ └── src/
│ │ └── TestBase.kt
│ ├── wasmJs/
│ │ └── src/
│ │ └── TestBase.kt
│ └── wasmWasi/
│ └── src/
│ └── TestBase.kt
└── ui/
├── README.md
├── coroutines-guide-ui.md
├── knit.code.include
├── knit.properties
├── kotlinx-coroutines-android/
│ ├── README.md
│ ├── android-unit-tests/
│ │ ├── build.gradle.kts
│ │ ├── resources/
│ │ │ └── META-INF/
│ │ │ └── services/
│ │ │ └── kotlinx.coroutines.CoroutineScope
│ │ ├── src/
│ │ │ └── EmptyCoroutineScopeImpl.kt
│ │ └── test/
│ │ └── ordered/
│ │ └── tests/
│ │ ├── CustomizedRobolectricTest.kt
│ │ ├── FirstMockedMainTest.kt
│ │ ├── FirstRobolectricTest.kt
│ │ ├── MockedMainTest.kt
│ │ ├── RobolectricTest.kt
│ │ └── TestComponent.kt
│ ├── api/
│ │ └── kotlinx-coroutines-android.api
│ ├── build.gradle.kts
│ ├── package.list
│ ├── resources/
│ │ └── META-INF/
│ │ ├── com.android.tools/
│ │ │ ├── proguard/
│ │ │ │ └── coroutines.pro
│ │ │ ├── r8-from-1.6.0/
│ │ │ │ └── coroutines.pro
│ │ │ └── r8-upto-3.0.0/
│ │ │ └── coroutines.pro
│ │ ├── proguard/
│ │ │ └── coroutines.pro
│ │ └── services/
│ │ ├── kotlinx.coroutines.CoroutineExceptionHandler
│ │ └── kotlinx.coroutines.internal.MainDispatcherFactory
│ ├── src/
│ │ ├── AndroidExceptionPreHandler.kt
│ │ ├── HandlerDispatcher.kt
│ │ └── module-info.java
│ ├── test/
│ │ ├── AndroidExceptionPreHandlerTest.kt
│ │ ├── DisabledHandlerTest.kt
│ │ ├── HandlerDispatcherAsyncTest.kt
│ │ ├── HandlerDispatcherTest.kt
│ │ └── R8ServiceLoaderOptimizationTest.kt
│ └── testdata/
│ ├── r8-test-common.pro
│ ├── r8-test-rules-no-optim.pro
│ └── r8-test-rules.pro
├── kotlinx-coroutines-javafx/
│ ├── README.md
│ ├── api/
│ │ └── kotlinx-coroutines-javafx.api
│ ├── build.gradle.kts
│ ├── resources/
│ │ └── META-INF/
│ │ └── services/
│ │ └── kotlinx.coroutines.internal.MainDispatcherFactory
│ ├── src/
│ │ ├── JavaFxConvert.kt
│ │ ├── JavaFxDispatcher.kt
│ │ └── module-info.java
│ └── test/
│ ├── JavaFxDispatcherTest.kt
│ ├── JavaFxObservableAsFlowTest.kt
│ ├── JavaFxStressTest.kt
│ ├── examples/
│ │ ├── FxAsFlow.kt
│ │ └── FxExampleApp.kt
│ └── guide/
│ ├── example-ui-actor-01.kt
│ ├── example-ui-actor-02.kt
│ ├── example-ui-actor-03.kt
│ ├── example-ui-advanced-01.kt
│ ├── example-ui-advanced-02.kt
│ ├── example-ui-basic-01.kt
│ ├── example-ui-basic-02.kt
│ ├── example-ui-basic-03.kt
│ ├── example-ui-blocking-01.kt
│ ├── example-ui-blocking-02.kt
│ └── example-ui-blocking-03.kt
└── kotlinx-coroutines-swing/
├── README.md
├── api/
│ └── kotlinx-coroutines-swing.api
├── build.gradle.kts
├── resources/
│ └── META-INF/
│ └── services/
│ └── kotlinx.coroutines.internal.MainDispatcherFactory
├── src/
│ ├── SwingDispatcher.kt
│ └── module-info.java
└── test/
├── SwingTest.kt
└── examples/
└── SwingExampleApp.kt
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: Our code behaves incorrectly?
title: ''
labels: bug
assignees: ''
---
<!--
**Double-check**
* Is this *really* a bug?
- If the behavior is documented, but you disagree with it, please do file an issue, but as a "Design consideration," not a "Bug report."
- If you don't understand why something behaves the way it does, consider asking on [StackOverflow](https://stackoverflow.com/) or the [Kotlin Slack](https://surveys.jetbrains.com/s3/kotlin-slack-sign-up). The community is active and will likely clarify everything better than we could!
* Is the problem not in some third-party library, not in [Kotlin](kotl.in/issue), or your own code—is it in the `kotlinx.coroutines` library itself?
- Example: you write for Android, and your code works properly on most devices, but for a couple of them, it fails. Then please direct this to Google and/or the manufacturer of your device.
* Maybe you're using some ancient version, and the problem doesn't happen with the latest releases of the compiler and the library?
-->
**Describe the bug**
What happened? What should have happened instead?
**Provide a Reproducer**
* If possible, please provide a small self-contained project (or even just a single file) where the issue reproduces.
* If you can't pinpoint the issue, please provide at least *some* project where this reproduces, for example, your production one. If you are not ready to show the project publicly, we are open to discussing the details privately.
* If you really can't provide any code, please do still open an issue. This may prompt other people to chime in with their reproducers.
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: true
contact_links:
- name: Kotlinlang Slack
url: https://surveys.jetbrains.com/s3/kotlin-slack-sign-up
about: Please ask and answer usage-related questions here.
================================================
FILE: .github/ISSUE_TEMPLATE/design_considerations.md
================================================
---
name: Design considerations
about: We didn't think things through?
title: ''
labels: design
assignees: ''
---
<!--
This is a place for issue reports that are not exactly bugs (wrong unintentional behavior) but for our library behaving suboptimally (though this could have been intentional).
**Double-check**
* If the behavior is strange, surprising, and undocumented, it could be a good idea to file a "Bug report" instead.
* Is this still relevant with the latest version of the library? We could have changed this already.
* Maybe there are good reasons for the existing behavior. Please try searching for existing discussions of the problem.
* Are you using the right abstraction? Consider asking on [StackOverflow](https://stackoverflow.com/) or the [Kotlin Slack](https://surveys.jetbrains.com/s3/kotlin-slack-sign-up). Maybe your need is better solved by some other abstraction entirely.
-->
**What do we have now?**
Preferably with specific code examples.
**What should be instead?**
Preferably with specific code examples.
**Why?**
The upsides of your proposal.
* Who would benefit from this and how?
- Would it be possible to cover new use cases?
- Would some code become clearer?
- Would the library become conceptually simpler?
- etc.
**Why not?**
The downsides of your proposal that you already see.
* Is this a breaking change?
* Are there use cases that are better solved by what we have now?
* Does some code become less clear after this change?
* etc.
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature request
about: We're missing something?
title: ''
labels: enhancement
assignees: ''
---
<!--
**Double-check**
* Maybe this feature is already here?
- Did you check the latest version of the library?
- Maybe it's in a form you didn't expect? Consider asking on [StackOverflow](https://stackoverflow.com/) or the [Kotlin Slack](https://surveys.jetbrains.com/s3/kotlin-slack-sign-up). The community will likely come up with some code that solves your need, and faster than it would take us to answer the issue!
* Do you actually *need* this feature? Maybe restructuring your code would neatly eliminate the problem the feature would be solving.
* Is the coroutines library the best place for this feature? Maybe it would be better suited for some third-party library?
-->
**Use case**
Explain what *specifically* you are trying to do and why.
- Example: "I have a `SharedFlow<Double>` that represents readings from an external device. The readings arrive in a set interval of 100 milliseconds. However, I also need to be able to calibrate the state of the external device by setting the readings from inside the program. When I set the state, the `SharedFlow<Double>` must immediately emit the value that was set and ignore any values coming from the device in the following 10 milliseconds since they are considered outdated, as the device is only guaranteed to recalibrate to the updated value after that period."
- Non-example: "I have a `SharedFlow<T>` that has several sources of its values, and these sources need to have priorities attached to them so that one source always takes precedence over the other in a close race."
- Non-example: "RxJava has feature X, so the coroutines library should also."
**The Shape of the API**
What could the desired API look like? What would some sample code using the new feature look like? If you don't have a clear idea, pseudocode or just explaining the API shape is also perfectly fine.
**Prior Art**
(Optional) Maybe you have seen something like the feature you need, but in other libraries, or there is something very similar but not quite sufficient in `kotlinx.coroutines`? Maybe there's already a way to do it, but it's too cumbersome and unclear?
================================================
FILE: .github/ISSUE_TEMPLATE/guide.md
================================================
---
name: Issue with the Coroutines guide
about: Problems on https://kotlinlang.org/docs/coroutines-guide.html
title: ''
labels: guide
assignees: ''
---
**Which page?**
Drop a link to a specific page, unless you're reporting something that's missing entirely.
**What can be improved?**
Describe the problematic part. Is it misleading, unclear, or just something that didn’t work for you?
**Is this explained better somewhere else?**
Show us the explanation that made it click for you.
================================================
FILE: .github/ISSUE_TEMPLATE/rc_feedback.md
================================================
---
name: Release Candidate release feedback
about: Something used to work, but broke in an RC release?
title: 'RC:'
labels: bug
assignees: ''
---
<!--
Thank you for participating in the Release Candidate program, and even better,
finding a problem!
Please double-check that this problem is not present in the latest stable
release.
-->
**What broke?**
Even a vague description suffices. If you want to search for a reproducer or
narrow the issue down, this would help a lot, but the most important thing is
letting us know that there is a problem at all as soon as possible. Otherwise,
we'll just publish a stable release with this problem while you're looking for a
reproducer!
**Did I check that setting the version to the latest stable release fixes the problem?**
Yes.
================================================
FILE: .gitignore
================================================
**/.idea/*
!/.idea/icon.png
!/.idea/vcs.xml
!/.idea/copyright
!/.idea/codeStyleSettings.xml
!/.idea/codeStyles
!/.idea/dictionaries
*.iml
.gradle
.gradletasknamecache
build
out
target
local.properties
benchmarks.jar
/kotlin-js-store
/.kotlin
================================================
FILE: .idea/codeStyleSettings.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value />
</option>
</component>
</project>
================================================
FILE: .idea/codeStyles/Project.xml
================================================
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JetCodeStyleSettings>
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="1" />
<option name="NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS" value="1" />
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>
================================================
FILE: .idea/codeStyles/codeStyleConfig.xml
================================================
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>
================================================
FILE: .idea/copyright/profiles_settings.xml
================================================
<component name="CopyrightManager">
<settings default="kotlinx.coroutines" />
</component>
================================================
FILE: .idea/dictionaries/shared.xml
================================================
<component name="ProjectDictionaryState">
<dictionary name="shared">
<words>
<w>Alistarh</w>
<w>Elizarov</w>
<w>Koval</w>
<w>kotlinx</w>
<w>lincheck</w>
<w>linearizability</w>
<w>linearizable</w>
<w>redirector</w>
</words>
</dictionary>
</component>
================================================
FILE: .idea/vcs.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CommitMessageInspectionProfile">
<profile version="1.0">
<inspection_tool class="GraziCommit" enabled="true" level="TYPO" enabled_by_default="true" />
<inspection_tool class="SubjectBodySeparation" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>
<component name="IssueNavigationConfiguration">
<option name="links">
<list>
<IssueNavigationLink>
<option name="issueRegexp" value="#(\d+)" />
<option name="linkRegexp" value="https://github.com/Kotlin/kotlinx.coroutines/issues/$1" />
</IssueNavigationLink>
</list>
</option>
</component>
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
================================================
FILE: CHANGES.md
================================================
# Change log for kotlinx.coroutines
## Version 1.10.2
* Fixed the `kotlinx-coroutines-debug` JAR file including the `module-info.class` file twice, resulting in failures in various tooling (#4314). Thanks, @RyuNen344!
* Fixed `Flow.stateIn` hanging when the scope is cancelled in advance or the flow is empty (#4322). Thanks, @francescotescari!
* Improved handling of dispatcher failures in `.limitedParallelism` (#4330) and during flow collection (#4272).
* Fixed `runBlocking` failing to run its coroutine to completion in some cases if its JVM thread got interrupted (#4399).
* Small tweaks, fixes, and documentation improvements.
## Version 1.10.1
* Fixed binary incompatibility introduced for non-JVM targets in #4261 (#4309).
## Version 1.10.0
* Kotlin was updated to 2.1.0 (#4284).
* Introduced `Flow.any`, `Flow.all`, and `Flow.none` (#4212). Thanks, @CLOVIS-AI!
* Reorganized `kotlinx-coroutines-debug` and `kotlinx-coroutines-core` code to avoid a split package between the two artifacts (#4247). Note that directly referencing `kotlinx.coroutines.debug.AgentPremain` must now be replaced with `kotlinx.coroutines.debug.internal.AgentPremain`. Thanks, @sellmair!
* No longer shade byte-buddy in `kotlinx-coroutines-debug`, reducing the artifact size and simplifying the build configuration of client code. Thanks, @sellmair!
* Fixed `NullPointerException` when using Java-deserialized `kotlinx-coroutines-core` exceptions (#4291). Thanks, @AlexRiedler!
* Properly report exceptions thrown by `CoroutineDispatcher.dispatch` instead of raising internal errors (#4091). Thanks, @zuevmaxim!
* Fixed a bug that delayed scheduling of a `Dispatchers.Default` or `Dispatchers.IO` task after a `yield()` in rare scenarios (#4248).
* Fixed a bug that prevented the `main()` coroutine on Wasm/WASI from executing after a `delay()` call in some scenarios (#4239).
* Fixed scheduling of `runBlocking` tasks on Kotlin/Native that arrive after the `runBlocking` block was exited (#4245).
* Fixed some terminal `Flow` operators sometimes resuming without taking cancellation into account (#4254). Thanks, @jxdabc!
* Fixed a bug on the JVM that caused coroutine-bound `ThreadLocal` values not to get cleaned when using non-`CoroutineDispatcher` continuation interceptors (#4296).
* Small tweaks, fixes, and documentation improvements.
## Version 1.9.0
### Features
* Wasm/WASI target support (#4064). Thanks, @igoriakovlev!
* `limitedParallelism` now optionally accepts the name of the dispatcher view for easier debugging (#4023).
* No longer initialize `Dispatchers.IO` on the JVM when other standard dispatchers are accessed (#4166). Thanks, @metalhead8816!
* Introduced the `Flow<T>.chunked(size: Int): Flow<List<T>>` operator that groups emitted values into groups of the given size (#1290).
* Closeable dispatchers are instances of `AutoCloseable` now (#4123).
### Fixes
* Calling `hasNext` on a `Channel`'s iterator is idempotent (#4065). Thanks, @gitpaxultek!
* `CoroutineScope()` created without an explicit dispatcher uses `Dispatchers.Default` on Native (#4074). Thanks, @whyoleg!
* Fixed a bug that prevented non-Android `Dispatchers.Main` from initializing when the Firebase dependency is used (#3914).
* Ensured a more intuitive ordering of tasks in `runBlocking` (#4134).
* Forbid casting a `Mutex` to `Semaphore` (#4176).
* Worked around a stack overflow that may occur when calling `asDeferred` on a `Future` many times (#4156).
### Deprecations and promotions
* Advanced the deprecation levels for `BroadcastChannel`-based API (#4197).
* Advanced the deprecation levels for the old `kotlinx-coroutines-test` API (#4198).
* Deprecated `Job.cancelFutureOnCompletion` (#4173).
* Promoted `CoroutineDispatcher.limitedParallelism` to stable (#3864).
* Promoted `CoroutineStart.ATOMIC` from `ExperimentalCoroutinesApi` to `DelicateCoroutinesApi` (#4169).
* Promoted `CancellableContinuation.resume` with an `onCancellation` lambda to stable, providing extra arguments to the lambda (#4088).
* Marked the classes and interfaces that are not supposed to be inherited from with the new `InternalForInheritanceCoroutinesApi` opt-in (#3770).
* Marked the classes and interfaces inheriting from which is not stable with the new `ExperimentalForInheritanceCoroutinesApi` opt-in (#3770).
### Other
* Kotlin was updated to 2.0 (#4137).
* Reworked the documentation for `CoroutineStart` and `Channel`-based API (#4147, #4148, #4167). Thanks, @globsterg!
* Simplified the internal implementation of `Job` (#4053).
* Small tweaks, fixes, and documentation improvements.
## Version 1.9.0-RC.2
* Advanced the deprecation levels for `BroadcastChannel`-based API (#4197).
* Advanced the deprecation levels for the old `kotlinx-coroutines-test` API (#4198).
* Promoted `CoroutineStart.ATOMIC` from `ExperimentalCoroutinesApi` to `DelicateCoroutinesApi` (#4169).
* Reworked the documentation for `CoroutineStart` and `Channel`-based API (#4147, #4148, #4167). Thanks, @globsterg!
* Forbid casting a `Mutex` to `Semaphore` (#4176).
* Deprecated `Job.cancelFutureOnCompletion` (#4173).
* Worked around a stack overflow that may occur when calling `asDeferred` on a `Future` many times (#4156).
* Fixed a bug that disallowed setting a custom `probeCoroutineResumed` when starting coroutines with `UNDISPATCHED` (#4162).
* No longer initialize `Dispatchers.IO` on the JVM when other standard dispatchers are accessed (#4166). Thanks, @metalhead8816!
* Small tweaks, fixes, and documentation improvements.
## Version 1.9.0-RC
* Kotlin was updated to 2.0 (#4137).
* Introduced the `Flow<T>.chunked(size: Int): Flow<List<T>>` operator that groups emitted values into groups of the given size (#1290).
* Closeable dispatchers are instances of `AutoCloseable` now (#4123).
* `limitedParallelism` now optionally accepts the name of the dispatcher view for easier debugging (#4023).
* Marked the classes and interfaces that are not supposed to be inherited from with the new `InternalForInheritanceCoroutinesApi` opt-in (#3770).
* Marked the classes and interfaces inheriting from which is not stable with the new `ExperimentalForInheritanceCoroutinesApi` opt-in (#3770).
* Wasm/WASI target support (#4064). Thanks, @igoriakovlev!
* Promoted `CoroutineDispatcher.limitedParallelism` to stable (#3864).
* Promoted `CancellableContinuation.resume` with an `onCancellation` lambda to stable, providing extra arguments to the lambda (#4088).
* Ensured a more intuitive ordering of tasks in `runBlocking` (#4134).
* Simplified the internal implementation of `Job` (#4053).
* Fixed a bug that prevented non-Android `Dispatchers.Main` from initializing when the Firebase dependency is used (#3914).
* Calling `hasNext` on a `Channel`'s iterator is idempotent (#4065). Thanks, @gitpaxultek!
* `CoroutineScope()` created without an explicit dispatcher uses `Dispatchers.Default` on Native (#4074). Thanks, @whyoleg!
* Small tweaks and documentation fixes.
## Version 1.8.1
* Remove the `@ExperimentalTime` annotation from usages of `TimeSource` (#4046). Thanks, @hfhbd!
* Introduce a workaround for an Android bug that caused an occasional `NullPointerException` when setting the `StateFlow` value on old Android devices (#3820).
* No longer use `kotlin.random.Random` as part of `Dispatchers.Default` and `Dispatchers.IO` initialization (#4051).
* `Flow.timeout` throws the exception with which the channel was closed (#4071).
* Small tweaks and documentation fixes.
### Changelog relative to version 1.8.1-Beta
* `Flow.timeout` throws the exception with which the channel was closed (#4071).
* Small documentation fixes.
## Version 1.8.1-Beta
* Remove the `@ExperimentalTime` annotation from usages of `TimeSource` (#4046). Thanks, @hfhbd!
* Attempt a workaround for an Android bug that caused an occasional `NullPointerException` when setting the `StateFlow` value on old Android devices (#3820).
* No longer use `kotlin.random.Random` as part of `Dispatchers.Default` and `Dispatchers.IO` initialization (#4051).
* Small tweaks.
## Version 1.8.0
* Implement the library for the Web Assembly (Wasm) for JavaScript (#3713). Thanks @igoriakovlev!
* Major Kotlin version update: was 1.8.20, became 1.9.21.
* On Android, ensure that `Dispatchers.Main != Dispatchers.Main.immediate` (#3545, #3963).
* Fixed a bug that caused `Flow` operators that limit cancel the upstream flow to forget that they were already finished if there is another such operator upstream (#4035, #4038)
* `kotlinx-coroutines-debug` is published with the correct Java 9 module info (#3944).
* `kotlinx-coroutines-debug` no longer requires manually setting `DebugProbes.enableCoroutineCreationStackTraces` to `false`, it's the default (#3783).
* `kotlinx-coroutines-test`: set the default timeout of `runTest` to 60 seconds, added the ability to configure it on the JVM with the `kotlinx.coroutines.test.default_timeout=10s` (#3800).
* `kotlinx-coroutines-test`: fixed a bug that could lead to not all uncaught exceptions being reported after some tests failed (#3800).
* `delay(Duration)` rounds nanoseconds up to whole milliseconds and not down (#3920). Thanks @kevincianfarini!
* `Dispatchers.Default` and the default thread for background work are guaranteed to use the same context classloader as the object containing it them (#3832).
* It is guaranteed that by the time `SharedFlow.collect` suspends for the first time, it's registered as a subscriber for that `SharedFlow` (#3885). Before, it was also true, but not documented.
* Atomicfu version is updated to 0.23.1, and Kotlin/Native atomic transformations are enabled, reducing the footprint of coroutine-heavy code (#3954).
* Added a workaround for miscompilation of `withLock` on JS (#3881). Thanks @CLOVIS-AI!
* Small tweaks and documentation fixes.
### Changelog relative to version 1.8.0-RC2
* `kotlinx-coroutines-debug` no longer requires manually setting `DebugProbes.enableCoroutineCreationStackTraces` to `false`, it's the default (#3783).
* Fixed a bug that caused `Flow` operators that limit cancel the upstream flow to forget that they were already finished if there is another such operator upstream (#4035, #4038)
* Small documentation fixes.
## Version 1.8.0-RC2
* Fixed a bug introduced in 1.8.0-RC where `Mutex.onLock` would not unlock if a non-local return was performed (#3985).
* Fixed a bug introduced in 1.8.0-RC where depending on kotlinx-coroutines in Native code failed with a compilation error `Could not find "org.jetbrains.kotlinx:atomicfu-cinterop-interop"` (#3968).
* Small documentation fixes.
## Version 1.8.0-RC
* Implement the library for the Web Assembly (Wasm) for JavaScript (#3713). Thanks @igoriakovlev!
* On Android, ensure that `Dispatchers.Main != Dispatchers.Main.immediate` (#3545, #3963).
* `kotlinx-coroutines-debug` is published with the correct Java 9 module info (#3944).
* Major Kotlin version update: was 1.8.20, became 1.9.21.
* `kotlinx-coroutines-test`: set the default timeout of `runTest` to 60 seconds, added the ability to configure it on the JVM with the `kotlinx.coroutines.test.default_timeout=10s` (#3800).
* `kotlinx-coroutines-test`: fixed a bug that could lead to not all uncaught exceptions being reported after some tests failed (#3800).
* `delay(Duration)` rounds nanoseconds up to whole milliseconds and not down (#3920). Thanks @kevincianfarini!
* `Dispatchers.Default` and the default thread for background work are guaranteed to use the same context classloader as the object containing it them (#3832).
* It is guaranteed that by the time `SharedFlow.collect` suspends for the first time, it's registered as a subscriber for that `SharedFlow` (#3885). Before, it was also true, but not documented.
* Atomicfu version is updated to 0.23.1, and Kotlin/Native atomic transformations are enabled, reducing the footprint of coroutine-heavy code (#3954).
* Added a workaround for miscompilation of `withLock` on JS (#3881). Thanks @CLOVIS-AI!
* Small tweaks and documentation fixes.
## Version 1.7.3
* Disabled the publication of the multiplatform library metadata for the old (1.6 and earlier) KMP Gradle plugin (#3809).
* Fixed a bug introduced in 1.7.2 that disabled the coroutine debugger in IDEA (#3822).
## Version 1.7.2
### Bug fixes and improvements
* Coroutines debugger no longer keeps track of coroutines with empty coroutine context (#3782).
* `CopyableThreadContextElement` now properly copies an element when crossing the coroutine boundary in `flowOn` (#3787). Thanks @wanyingd1996!
* Coroutine timeouts no longer prevent K/N `newSingleThreadContext` from closing (#3768).
* A non-linearizability in `Mutex` during `tryLock`/`unlock` sequence with owners is fixed (#3745).
* Atomicfu version is updated to 0.21.0.
## Version 1.7.1
### Bug fixes and improvements
* Special characters in coroutine names in JSON dumps are supported (#3747)
* The binary compatibility of the experimental overload of `runTest` is restored (#3673)
* Channels that don't use `onUndeliveredElement` now allocate less memory (#3646)
## Version 1.7.0
### Core API significant improvements
* New `Channel` implementation with significant performance improvements across the API (#3621).
* New `select` operator implementation: faster, more lightweight, and more robust (#3020).
* `Mutex` and `Semaphore` now share the same underlying data structure (#3020).
* `Dispatchers.IO` is added to K/N (#3205)
* `newFixedThreadPool` and `Dispatchers.Default` implementations on K/N were wholly rewritten to support graceful growth under load (#3595).
* `kotlinx-coroutines-test` rework:
- Add the `timeout` parameter to `runTest` for the whole-test timeout, 10 seconds by default (#3270). This replaces the configuration of quiescence timeouts, which is now deprecated (#3603).
- The `withTimeout` exception messages indicate if the timeout used the virtual time (#3588).
- `TestCoroutineScheduler`, `runTest`, and `TestScope` API are promoted to stable (#3622).
- `runTest` now also fails if there were uncaught exceptions in coroutines not inherited from the test coroutine (#1205).
### Breaking changes
* Old K/N memory model is no longer supported (#3375).
* New generic upper bounds were added to reactive integration API where the language since 1.8.0 dictates (#3393).
* `kotlinx-coroutines-core` and `kotlinx-coroutines-jdk8` artifacts were merged into a single artifact (#3268).
* Artificial stackframes in stacktrace recovery no longer contain the `\b` symbol and are now navigable in IDE and supplied with proper documentation (#2291).
* `CoroutineContext.isActive` returns `true` for contexts without any job in them (#3300).
### Bug fixes and improvements
* Kotlin version is updated to 1.8.20
* Atomicfu version is updated to 0.20.2.
* `JavaFx` version is updated to 17.0.2 in `kotlinx-coroutines-javafx` (#3671)..
* JPMS is supported (#2237). Thanks @lion7!
* `BroadcastChannel` and all the corresponding API are deprecated (#2680).
* Added all supported K/N targets (#3601, #812, #855).
* K/N `Dispatchers.Default` is backed by the number of threads equal to the number of available cores (#3366).
* Fixed an issue where some coroutines' internal exceptions were not properly serializable (#3328).
* Introduced `Job.parent` API (#3201).
* Fixed a bug when `TestScheduler` leaked cancelled jobs (#3398).
* `TestScope.timeSource` now provides comparable time marks (#3617). Thanks @hfhbd!
* Fixed an issue when cancelled `withTimeout` handles were preserved in JS runtime (#3440).
* Ensure `awaitFrame` only awaits a single frame when used from the main looper (#3432). Thanks @pablobaxter!
* Obsolete `Class-Path` attribute was removed from `kotlinx-coroutines-debug.jar` manifest (#3361).
* Fixed a bug when `updateThreadContext` operated on the parent context (#3411).
* Added new `Flow.filterIsInstance` extension (#3240).
* `Dispatchers.Default` thread name prefixes are now configurable with system property (#3231).
* Added `Flow.timeout` operator as `@FlowPreview` (#2624). Thanks @pablobaxter!
* Improved the performance of the `future` builder in case of exceptions (#3475). Thanks @He-Pin!
* `Mono.awaitSingleOrNull` now waits for the `onComplete` signal (#3487).
* `Channel.isClosedForSend` and `Channel.isClosedForReceive` are promoted from experimental to delicate (#3448).
* Fixed a data race in native `EventLoop` (#3547).
* `Dispatchers.IO.limitedParallelism(valueLargerThanIOSize)` no longer creates an additional wrapper (#3442). Thanks @dovchinnikov!
* Various `@FlowPreview` and `@ExperimentalCoroutinesApi` are promoted to experimental and stable respectively (#3542, #3097, #3548).
* Performance improvements in `Dispatchers.Default` and `Dispatchers.IO` (#3416, #3418).
* Fixed a bug when internal `suspendCancellableCoroutineReusable` might have hanged (#3613).
* Introduced internal API to process events in the current system dispatcher (#3439).
* Global `CoroutineExceptionHandler` is no longer invoked in case of unprocessed `future` failure (#3452).
* Performance improvements and reduced thread-local pressure for the `withContext` operator (#3592).
* Improved performance of `DebugProbes` (#3527).
* Fixed a bug when the coroutine debugger might have detected the state of a coroutine incorrectly (#3193).
* `CoroutineDispatcher.asExecutor()` runs tasks without dispatching if the dispatcher is unconfined (#3683). Thanks @odedniv!
* `SharedFlow.toMutableList` and `SharedFlow.toSet` lints are introduced (#3706).
* `Channel.invokeOnClose` is promoted to stable API (#3358).
* Improved lock contention in `Dispatchers.Default` and `Dispatchers.IO` during the startup phase (#3652).
* Fixed a bug that led to threads oversubscription in `Dispatchers.Default` (#3642).
* Fixed a bug that allowed `limitedParallelism` to perform dispatches even after the underlying dispatcher was closed (#3672).
* Fixed a bug that prevented stacktrace recovery when the exception's constructor from `cause` was selected (#3714).
* Improved sanitizing of stracktrace-recovered traces (#3714).
* Introduced an internal flag to disable uncaught exceptions reporting in tests as a temporary migration mechanism (#3736).
* Various documentation improvements and fixes.
Changelog for previous versions may be found in [CHANGES_UP_TO_1.7.md](CHANGES_UP_TO_1.7.md)
================================================
FILE: CHANGES_UP_TO_1.7.md
================================================
# Change log for kotlinx.coroutines
## Version 1.7.0
### Core API significant improvements
* New `Channel` implementation with significant performance improvements across the API (#3621).
* New `select` operator implementation: faster, more lightweight, and more robust (#3020).
* `Mutex` and `Semaphore` now share the same underlying data structure (#3020).
* `Dispatchers.IO` is added to K/N (#3205)
* `newFixedThreadPool` and `Dispatchers.Default` implementations on K/N were wholly rewritten to support graceful growth under load (#3595).
* `kotlinx-coroutines-test` rework:
- Add the `timeout` parameter to `runTest` for the whole-test timeout, 10 seconds by default (#3270). This replaces the configuration of quiescence timeouts, which is now deprecated (#3603).
- The `withTimeout` exception messages indicate if the timeout used the virtual time (#3588).
- `TestCoroutineScheduler`, `runTest`, and `TestScope` API are promoted to stable (#3622).
- `runTest` now also fails if there were uncaught exceptions in coroutines not inherited from the test coroutine (#1205).
### Breaking changes
* Old K/N memory model is no longer supported (#3375).
* New generic upper bounds were added to reactive integration API where the language since 1.8.0 dictates (#3393).
* `kotlinx-coroutines-core` and `kotlinx-coroutines-jdk8` artifacts were merged into a single artifact (#3268).
* Artificial stackframes in stacktrace recovery no longer contain the `\b` symbol and are now navigable in IDE and supplied with proper documentation (#2291).
* `CoroutineContext.isActive` returns `true` for contexts without any job in them (#3300).
### Bug fixes and improvements
* Kotlin version is updated to 1.8.20
* Atomicfu version is updated to 0.20.2.
* `JavaFx` version is updated to 17.0.2 in `kotlinx-coroutines-javafx` (#3671)..
* JPMS is supported (#2237). Thanks @lion7!
* `BroadcastChannel` and all the corresponding API are deprecated (#2680).
* Added all supported K/N targets (#3601, #812, #855).
* K/N `Dispatchers.Default` is backed by the number of threads equal to the number of available cores (#3366).
* Fixed an issue where some coroutines' internal exceptions were not properly serializable (#3328).
* Introduced `Job.parent` API (#3201).
* Fixed a bug when `TestScheduler` leaked cancelled jobs (#3398).
* `TestScope.timeSource` now provides comparable time marks (#3617). Thanks @hfhbd!
* Fixed an issue when cancelled `withTimeout` handles were preserved in JS runtime (#3440).
* Ensure `awaitFrame` only awaits a single frame when used from the main looper (#3432). Thanks @pablobaxter!
* Obsolete `Class-Path` attribute was removed from `kotlinx-coroutines-debug.jar` manifest (#3361).
* Fixed a bug when `updateThreadContext` operated on the parent context (#3411).
* Added new `Flow.filterIsInstance` extension (#3240).
* `Dispatchers.Default` thread name prefixes are now configurable with system property (#3231).
* Added `Flow.timeout` operator as `@FlowPreview` (#2624). Thanks @pablobaxter!
* Improved the performance of the `future` builder in case of exceptions (#3475). Thanks @He-Pin!
* `Mono.awaitSingleOrNull` now waits for the `onComplete` signal (#3487).
* `Channel.isClosedForSend` and `Channel.isClosedForReceive` are promoted from experimental to delicate (#3448).
* Fixed a data race in native `EventLoop` (#3547).
* `Dispatchers.IO.limitedParallelism(valueLargerThanIOSize)` no longer creates an additional wrapper (#3442). Thanks @dovchinnikov!
* Various `@FlowPreview` and `@ExperimentalCoroutinesApi` are promoted to experimental and stable respectively (#3542, #3097, #3548).
* Performance improvements in `Dispatchers.Default` and `Dispatchers.IO` (#3416, #3418).
* Fixed a bug when internal `suspendCancellableCoroutineReusable` might have hanged (#3613).
* Introduced internal API to process events in the current system dispatcher (#3439).
* Global `CoroutineExceptionHandler` is no longer invoked in case of unprocessed `future` failure (#3452).
* Performance improvements and reduced thread-local pressure for the `withContext` operator (#3592).
* Improved performance of `DebugProbes` (#3527).
* Fixed a bug when the coroutine debugger might have detected the state of a coroutine incorrectly (#3193).
* `CoroutineDispatcher.asExecutor()` runs tasks without dispatching if the dispatcher is unconfined (#3683). Thanks @odedniv!
* `SharedFlow.toMutableList` and `SharedFlow.toSet` lints are introduced (#3706).
* `Channel.invokeOnClose` is promoted to stable API (#3358).
* Improved lock contention in `Dispatchers.Default` and `Dispatchers.IO` during the startup phase (#3652).
* Fixed a bug that led to threads oversubscription in `Dispatchers.Default` (#3642).
* Fixed a bug that allowed `limitedParallelism` to perform dispatches even after the underlying dispatcher was closed (#3672).
* Fixed a bug that prevented stacktrace recovery when the exception's constructor from `cause` was selected (#3714).
* Improved sanitizing of stracktrace-recovered traces (#3714).
* Introduced an internal flag to disable uncaught exceptions reporting in tests as a temporary migration mechanism (#3736).
* Various documentation improvements and fixes.
### Changelog relative to version 1.7.0-RC
* Fixed a bug that prevented stacktrace recovery when the exception's constructor from `cause` was selected (#3714).
* Improved sanitizing of stracktrace-recovered traces (#3714).
* Introduced an internal flag to disable uncaught exceptions reporting in tests as a temporary migration mechanism (#3736).
## Version 1.7.0-RC
* Kotlin version is updated to 1.8.20.
* Atomicfu version is updated to 0.20.2.
* `JavaFx` version is updated to 17.0.2 in `kotlinx-coroutines-javafx` (#3671).
* `previous-compilation-data.bin` file is removed from JAR resources (#3668).
* `CoroutineDispatcher.asExecutor()` runs tasks without dispatching if the dispatcher is unconfined (#3683). Thanks @odedniv!
* `SharedFlow.toMutableList` lint overload is undeprecated (#3706).
* `Channel.invokeOnClose` is promoted to stable API (#3358).
* Improved lock contention in `Dispatchers.Default` and `Dispatchers.IO` during the startup phase (#3652).
* Fixed a bug that led to threads oversubscription in `Dispatchers.Default` (#3642).
* Fixed a bug that allowed `limitedParallelism` to perform dispatches even after the underlying dispatcher was closed (#3672).
* Restored binary compatibility of previously experimental `TestScope.runTest(Long)` (#3673).
## Version 1.7.0-Beta
### Core API significant improvements
* New `Channel` implementation with significant performance improvements across the API (#3621).
* New `select` operator implementation: faster, more lightweight, and more robust (#3020).
* `Mutex` and `Semaphore` now share the same underlying data structure (#3020).
* `Dispatchers.IO` is added to K/N (#3205)
* `newFixedThreadPool` and `Dispatchers.Default` implementations on K/N were wholly rewritten to support graceful growth under load (#3595).
* `kotlinx-coroutines-test` rework:
- Add the `timeout` parameter to `runTest` for the whole-test timeout, 10 seconds by default (#3270). This replaces the configuration of quiescence timeouts, which is now deprecated (#3603).
- The `withTimeout` exception messages indicate if the timeout used the virtual time (#3588).
- `TestCoroutineScheduler`, `runTest`, and `TestScope` API are promoted to stable (#3622).
- `runTest` now also fails if there were uncaught exceptions in coroutines not inherited from the test coroutine (#1205).
### Breaking changes
* Old K/N memory model is no longer supported (#3375).
* New generic upper bounds were added to reactive integration API where the language since 1.8.0 dictates (#3393).
* `kotlinx-coroutines-core` and `kotlinx-coroutines-jdk8` artifacts were merged into a single artifact (#3268).
* Artificial stackframes in stacktrace recovery no longer contain the `\b` symbol and are now navigable in IDE and supplied with proper documentation (#2291).
* `CoroutineContext.isActive` returns `true` for contexts without any job in them (#3300).
### Bug fixes and improvements
* Kotlin version is updated to 1.8.10.
* JPMS is supported (#2237). Thanks @lion7!
* `BroadcastChannel` and all the corresponding API are deprecated (#2680).
* Added all supported K/N targets (#3601, #812, #855).
* K/N `Dispatchers.Default` is backed by the number of threads equal to the number of available cores (#3366).
* Fixed an issue where some coroutines' internal exceptions were not properly serializable (#3328).
* Introduced `Job.parent` API (#3201).
* Fixed a bug when `TestScheduler` leaked cancelled jobs (#3398).
* `TestScope.timeSource` now provides comparable time marks (#3617). Thanks @hfhbd!
* Fixed an issue when cancelled `withTimeout` handles were preserved in JS runtime (#3440).
* Ensure `awaitFrame` only awaits a single frame when used from the main looper (#3432). Thanks @pablobaxter!
* Obsolete `Class-Path` attribute was removed from `kotlinx-coroutines-debug.jar` manifest (#3361).
* Fixed a bug when `updateThreadContext` operated on the parent context (#3411).
* Added new `Flow.filterIsInstance` extension (#3240).
* `Dispatchers.Default` thread name prefixes are now configurable with system property (#3231).
* Added `Flow.timeout` operator as `@FlowPreview` (#2624). Thanks @pablobaxter!
* Improved the performance of the `future` builder in case of exceptions (#3475). Thanks @He-Pin!
* `Mono.awaitSingleOrNull` now waits for the `onComplete` signal (#3487).
* `Channel.isClosedForSend` and `Channel.isClosedForReceive` are promoted from experimental to delicate (#3448).
* Fixed a data race in native `EventLoop` (#3547).
* `Dispatchers.IO.limitedParallelism(valueLargerThanIOSize)` no longer creates an additional wrapper (#3442). Thanks @dovchinnikov!
* Various `@FlowPreview` and `@ExperimentalCoroutinesApi` are promoted to experimental and stable respectively (#3542, #3097, #3548).
* Performance improvements in `Dispatchers.Default` and `Dispatchers.IO` (#3416, #3418).
* Fixed a bug when internal `suspendCancellableCoroutineReusable` might have hanged (#3613).
* Introduced internal API to process events in the current system dispatcher (#3439).
* Global `CoroutineExceptionHandler` is no longer invoked in case of unprocessed `future` failure (#3452).
* Performance improvements and reduced thread-local pressure for the `withContext` operator (#3592).
* Improved performance of `DebugProbes` (#3527).
* Fixed a bug when the coroutine debugger might have detected the state of a coroutine incorrectly (#3193).
* Various documentation improvements and fixes.
## Version 1.6.4
* Added `TestScope.backgroundScope` for launching coroutines that perform work in the background and need to be cancelled at the end of the test (#3287).
* Fixed the POM of `kotlinx-coroutines-debug` having an incorrect reference to `kotlinx-coroutines-bom`, which cause the builds of Maven projects using the debug module to break (#3334).
* Fixed the `Publisher.await` functions in `kotlinx-coroutines-reactive` not ensuring that the `Subscriber` methods are invoked serially (#3360). Thank you, @EgorKulbachka!
* Fixed a memory leak in `withTimeout` on K/N with the new memory model (#3351).
* Added the guarantee that all `Throwable` implementations in the core library are serializable (#3328).
* Moved the documentation to <https://kotlinlang.org/api/kotlinx.coroutines/> (#3342).
* Various documentation improvements.
## Version 1.6.3
* Updated atomicfu version to 0.17.3 (#3321), fixing the projects using this library with JS IR failing to build (#3305).
## Version 1.6.2
* Fixed a bug with `ThreadLocalElement` not being correctly updated when the most outer `suspend` function was called directly without `kotlinx.coroutines` (#2930).
* Fixed multiple data races: one that might have been affecting `runBlocking` event loop, and a benign data race in `Mutex` (#3250, #3251).
* Obsolete `TestCoroutineContext` is removed, which fixes the `kotlinx-coroutines-test` JPMS package being split between `kotlinx-coroutines-core` and `kotlinx-coroutines-test` (#3218).
* Updated the ProGuard rules to further shrink the size of the resulting DEX file with coroutines (#3111, #3263). Thanks, @agrieve!
* Atomicfu is updated to `0.17.2`, which includes a more efficient and robust JS IR transformer (#3255).
* Kotlin is updated to `1.6.21`, Gradle version is updated to `7.4.2` (#3281). Thanks, @wojtek-kalicinski!
* Various documentation improvements.
## Version 1.6.1
* Rollback of time-related functions dispatching on `Dispatchers.Main`.
This behavior was introduced in 1.6.0 and then found inconvenient and erroneous (#3106, #3113).
* Reworked the newly-introduced `CopyableThreadContextElement` to solve issues uncovered after the initial release (#3227).
* Fixed a bug with `ThreadLocalElement` not being properly updated in racy scenarios (#2930).
* Reverted eager loading of default `CoroutineExceptionHandler` that triggered ANR on some devices (#3180).
* New API to convert a `CoroutineDispatcher` to a Rx scheduler (#968, #548). Thanks @recheej!
* Fixed a memory leak with the very last element emitted from `flow` builder being retained in memory (#3197).
* Fixed a bug with `limitedParallelism` on K/N with new memory model throwing `ClassCastException` (#3223).
* `CoroutineContext` is added to the exception printed to the default `CoroutineExceptionHandler` to improve debuggability (#3153).
* Static memory consumption of `Dispatchers.Default` was significantly reduced (#3137).
* Updated slf4j version in `kotlinx-coroutines-slf4j` from 1.7.25 to 1.7.32.
## Version 1.6.0
Note that this is a full changelog relative to the 1.5.2 version. Changelog relative to 1.6.0-RC3 can be found at the end.
### kotlinx-coroutines-test rework
* `kotlinx-coroutines-test` became a multiplatform library usable from K/JVM, K/JS, and K/N.
* Its API was completely reworked to address long-standing issues with consistency, structured concurrency and correctness (#1203, #1609, #2379, #1749, #1204, #1390, #1222, #1395, #1881, #1910, #1772, #1626, #1742, #2082, #2102, #2405, #2462
).
* The old API is deprecated for removal, but the new API is based on the similar concepts ([README](kotlinx-coroutines-test/README.md)), and the migration path is designed to be graceful: [migration guide](kotlinx-coroutines-test/MIGRATION.md).
### Dispatchers
* Introduced `CoroutineDispatcher.limitedParallelism` that allows obtaining a view of the original dispatcher with limited parallelism (#2919).
* `Dispatchers.IO.limitedParallelism` usages ignore the bound on the parallelism level of `Dispatchers.IO` itself to avoid starvation (#2943).
* Introduced new `Dispatchers.shutdown` method for containerized environments (#2558).
* `newSingleThreadContext` and `newFixedThreadPoolContext` are promoted to delicate API (#2919).
### Breaking changes
* When racing with cancellation, the `future` builder no longer reports unhandled exceptions into the global `CoroutineExceptionHandler`. Thanks @vadimsemenov! (#2774, #2791).
* `Mutex.onLock` is deprecated for removal (#2794).
* `Dispatchers.Main` is now used as the default source of time for `delay` and `withTimeout` when present(#2972).
* To opt-out from this behaviour, `kotlinx.coroutines.main.delay` system property can be set to `false`.
* Java target of coroutines build is now 8 instead of 6 (#1589).
* **Source-breaking change**: extension `collect` no longer resolves when used with a non-in-place argument of a functional type. This is a candidate for a fix, uncovered after 1.6.0, see #3107 for the additional details.
### Bug fixes and improvements
* Kotlin is updated to 1.6.0.
* Kotlin/Native [new memory model](https://blog.jetbrains.com/kotlin/2021/08/try-the-new-kotlin-native-memory-manager-development-preview/) is now supported in regular builds of coroutines conditionally depending on whether `kotlin.native.binary.memoryModel` is enabled (#2914).
* Introduced `CopyableThreadContextElement` for mutable context elements shared among multiple coroutines. Thanks @yorickhenning! (#2893).
* `transformWhile`, `awaitClose`, `ProducerScope`, `merge`, `runningFold`, `runingReduce`, and `scan` are promoted to stable API (#2971).
* `SharedFlow.subscriptionCount` no longer conflates incoming updates and gives all subscribers a chance to observe a short-lived subscription (#2488, #2863, #2871).
* `Flow` exception transparency mechanism is improved to be more exception-friendly (#3017, #2860).
* Cancellation from `flat*` operators that leverage multiple coroutines is no longer propagated upstream (#2964).
* `SharedFlow.collect` now returns `Nothing` (#2789, #2502).
* `DisposableHandle` is now `fun interface`, and corresponding inline extension is removed (#2790).
* `FlowCollector` is now `fun interface`, and corresponding inline extension is removed (#3047).
* Deprecation level of all previously deprecated signatures is raised (#3024).
* The version file is shipped with each JAR as a resource (#2941).
* Unhandled exceptions on K/N are passed to the standard library function `processUnhandledException` (#2981).
* A direct executor is used for `Task` callbacks in `kotlinx-coroutines-play-services` (#2990).
* Metadata of coroutines artifacts leverages Gradle platform to have all versions of dependencies aligned (#2865).
* Default `CoroutineExceptionHandler` is loaded eagerly and does not invoke `ServiceLoader` on its exception-handling path (#2552).
* Fixed the R8 rules for `ServiceLoader` optimization (#2880).
* Fixed BlockHound integration false-positives (#2894, #2866, #2937).
* Fixed the exception handler being invoked several times on Android, thanks to @1zaman (#3056).
* `SendChannel.trySendBlocking` is now available on Kotlin/Native (#3064).
* The exception recovery mechanism now uses `ClassValue` when available (#2997).
* JNA is updated to 5.9.0 to support Apple M1 (#3001).
* Obsolete method on internal `Delay` interface is deprecated (#2979).
* Support of deprecated `CommonPool` is removed.
* `@ExperimentalTime` is no longer needed for methods that use `Duration` (#3041).
* JDK 1.6 is no longer required for building the project (#3043).
* New version of Dokka is used, fixing the memory leak when building the coroutines and providing brand new reference visuals (https://kotlinlang.org/api/kotlinx.coroutines/) (#3051, #3054).
### Changelog relative to version 1.6.0-RC3
* Restored MPP binary compatibility on K/JS and K/N (#3104).
* Fixed Dispatchers.Main not being fully initialized on Android and Swing (#3101).
## Version 1.6.0-RC3
* Fixed the error in 1.6.0-RC2 because of which `Flow.collect` couldn't be called due to the `@InternalCoroutinesApi` annotation (#3082)
* Fixed some R8 warnings introduced in 1.6.0-RC (#3090)
* `TestCoroutineScheduler` now provides a `TimeSource` with its virtual time via the `timeSource` property. Thanks @hfhbd! (#3087)
## Version 1.6.0-RC2
* `@ExperimentalTime` is no longer needed for methods that use `Duration` (#3041).
* `FlowCollector` is now `fun interface`, and corresponding inline extension is removed (#3047).
* Fixed the exception handler being invoked several times on Android, thanks to @1zaman (#3056).
* The deprecated `TestCoroutineScope` is no longer sealed, to simplify migration from it (#3072).
* `runTest` gives more informative errors when it times out waiting for external completion (#3071).
* `SendChannel.trySendBlocking` is now available on Kotlin/Native (#3064).
* Fixed the bug due to which `Dispatchers.Main` was not used for `delay` and `withTimeout` (#3046).
* JDK 1.6 is no longer required for building the project (#3043).
* New version of Dokka is used, fixing the memory leak when building the coroutines and providing brand new reference visuals (https://kotlinlang.org/api/kotlinx.coroutines/) (#3051, #3054).
## Version 1.6.0-RC
### kotlinx-coroutines-test rework
* `kotlinx-coroutines-test` became a multiplatform library usable from K/JVM, K/JS, and K/N.
* Its API was completely reworked to address long-standing issues with consistency, structured concurrency and correctness (#1203, #1609, #2379, #1749, #1204, #1390, #1222, #1395, #1881, #1910, #1772, #1626, #1742, #2082, #2102, #2405, #2462
).
* The old API is deprecated for removal, but the new API is based on the similar concepts ([README](kotlinx-coroutines-test/README.md)), and the migration path is designed to be graceful: [migration guide](kotlinx-coroutines-test/MIGRATION.md)
### Dispatchers
* Introduced `CoroutineDispatcher.limitedParallelism` that allows obtaining a view of the original dispatcher with limited parallelism (#2919).
* `Dispatchers.IO.limitedParallelism` usages ignore the bound on the parallelism level of `Dispatchers.IO` itself to avoid starvation (#2943).
* Introduced new `Dispatchers.shutdown` method for containerized environments (#2558).
* `newSingleThreadContext` and `newFixedThreadPoolContext` are promoted to delicate API (#2919).
### Breaking changes
* When racing with cancellation, the `future` builder no longer reports unhandled exceptions into the global `CoroutineExceptionHandler`. Thanks @vadimsemenov! (#2774, #2791).
* `Mutex.onLock` is deprecated for removal (#2794).
* `Dispatchers.Main` is now used as the default source of time for `delay` and `withTimeout` when present(#2972).
* To opt-out from this behaviour, `kotlinx.coroutines.main.delay` system property can be set to `false`.
* Java target of coroutines build is now 8 instead of 6 (#1589).
### Bug fixes and improvements
* Kotlin is updated to 1.6.0.
* Kotlin/Native [new memory model](https://blog.jetbrains.com/kotlin/2021/08/try-the-new-kotlin-native-memory-manager-development-preview/) is now supported in regular builds of coroutines conditionally depending on whether `kotlin.native.binary.memoryModel` is enabled (#2914).
* Introduced `CopyableThreadContextElement` for mutable context elements shared among multiple coroutines. Thanks @yorickhenning! (#2893).
* `transformWhile`, `awaitClose`, `ProducerScope`, `merge`, `runningFold`, `runingReduce`, and `scan` are promoted to stable API (#2971).
* `SharedFlow.subscriptionCount` no longer conflates incoming updates and gives all subscribers a chance to observe a short-lived subscription (#2488, #2863, #2871).
* `Flow` exception transparency mechanism is improved to be more exception-friendly (#3017, #2860).
* Cancellation from `flat*` operators that leverage multiple coroutines is no longer propagated upstream (#2964).
* `SharedFlow.collect` now returns `Nothing` (#2789, #2502).
* `DisposableHandle` is now `fun interface`, and corresponding inline extension is removed (#2790).
* Deprecation level of all previously deprecated signatures is raised (#3024).
* The version file is shipped with each JAR as a resource (#2941).
* Unhandled exceptions on K/N are passed to the standard library function `processUnhandledException` (#2981).
* A direct executor is used for `Task` callbacks in `kotlinx-coroutines-play-services` (#2990).
* Metadata of coroutines artifacts leverages Gradle platform to have all versions of dependencies aligned (#2865).
* Default `CoroutineExceptionHandler` is loaded eagerly and does not invoke `ServiceLoader` on its exception-handling path (#2552).
* Fixed the R8 rules for `ServiceLoader` optimization (#2880).
* Fixed BlockHound integration false-positives (#2894, #2866, #2937).
* The exception recovery mechanism now uses `ClassValue` when available (#2997).
* JNA is updated to 5.9.0 to support Apple M1 (#3001).
* Obsolete method on internal `Delay` interface is deprecated (#2979).
* Support of deprecated `CommonPool` is removed.
## Version 1.5.2
* Kotlin is updated to 1.5.30.
* New native targets for Apple Silicon are introduced.
* Fixed a bug when `onUndeliveredElement` was incorrectly called on a properly received elements on JS (#2826).
* Fixed `Dispatchers.Default` on React Native, it now fully relies on `setTimeout` instead of stub `process.nextTick`. Thanks to @Legion2 (#2843).
* Optimizations of `Mutex` implementation (#2581).
* `Mutex` implementation is made completely lock-free as stated (#2590).
* Various documentation and guides improvements. Thanks to @MasoodFallahpoor and @Pihanya.
## Version 1.5.1
* Atomic `update`, `getAndUpdate`, and `updateAndGet` operations of `MutableStateFlow` (#2720).
* `Executor.asCoroutineDispatcher` implementation improvements (#2601):
* If the target executor is `ScheduledExecutorService`, then its `schedule` API is used for time-related coroutine operations.
* `RemoveOnCancelPolicy` is now part of the public contract.
* Introduced overloads for `Task.asDeferred` and `Task.await` that accept `CancellationTokenSource` for bidirectional cancellation (#2527).
* Reactive streams are updated to `1.0.3` (#2740).
* `CopyableThrowable` is allowed to modify the exception message during stacktrace recovery (#1931).
* `CoroutineDispatcher.releaseInterceptedContinuation` is now a `final` method (#2785).
* Closing a Handler underlying `Handler.asCoroutineDispatcher` now causes the dispatched coroutines to be canceled on `Dispatchers.IO (#2778)`.
* Kotlin is updated to 1.5.20.
* Fixed a spurious `ClassCastException` in `releaseInterceptedContinuation` and `IllegalStateException` from `tryReleaseClaimedContinuation` (#2736, #2768).
* Fixed inconsistent exception message during stacktrace recovery for non-suspending channel iterators (#2749).
* Fixed linear stack usage for `CompletableFuture.asDeferred` when the target future has a long chain of listeners (#2730).
* Any exceptions from `CoroutineDispatcher.isDispatchNeeded` are now considered as fatal and are propagated to the caller (#2733).
* Internal `DebugProbesKt` (used in the debugger implementation) are moved from `debug` to `core` module.
## Version 1.5.0
Note that this is a full changelog relative to 1.4.3 version. Changelog relative to 1.5.0-RC can be found in the end.
### Channels API
* Major channels API rework (#330, #974). Existing `offer`, `poll`, and `sendBlocking` methods are deprecated, internal `receiveCatching` and `onReceiveCatching` removed, `receiveOrNull` and `onReceiveOrNull` are completely deprecated. Previously deprecated `SendChannel.isFull` declaration is removed. Channel operators deprecated with `ERROR` are now `HIDDEN`.
* New methods `receiveCatching`, `onReceiveCatching` `trySend`, `tryReceive`, and `trySendBlocking` along with the new result type `ChannelResult` are introduced. They provide better type safety, are less error-prone, and have a consistent future-proof naming scheme. The full rationale behind this change can be found [here](https://github.com/Kotlin/kotlinx.coroutines/issues/974#issuecomment-806569582).
* `BroadcastChannel` and `ConflatedBroadcastChannel` are marked as `ObsoleteCoroutinesApi` in the favor or `SharedFlow` and `StateFlow`. The migration scheme can be found in their documentation. These classes will be deprecated in the next major release.
* `callbackFlow` and `channelFlow` are promoted to stable API.
### Reactive integrations
* All existing API in modules `kotlinx-coroutines-rx2`, `kotlinx-coroutines-rx3`, `kotlinx-coroutines-reactive`, `kotlinx-coroutines-reactor`, and `kotlinx-coroutines-jdk9` were revisited and promoted to stable (#2545).
* `publish` is no longer allowed to emit `null` values (#2646).
* Misleading `awaitSingleOr*` functions on `Publisher` type are deprecated (#2591).
* `MaybeSource.await` is deprecated in the favor of `awaitSingle`, additional lint functions for `Mono` are added in order to prevent ambiguous `Publisher` usages (#2628, #1587).
* `ContextView` support in `kotlinx-coroutines-reactor` (#2575).
* All reactive builders no longer ignore inner cancellation exceptions preventing their completion (#2262, #2646).
* `MaybeSource.collect` and `Maybe.collect` properly finish when they are completed without a value (#2617).
* All exceptions are now consistently handled according to reactive specification, whether they are considered 'fatal' or not by reactive frameworks (#2646).
### Other improvements
* Kotlin version is upgraded to 1.5.0 and JVM target is updated to 1.8.
* `Flow.last` and `Flow.lastOrNull` operators (#2246).
* `Flow.runningFold` operator (#2641).
* `CoroutinesTimeout` rule for JUnit5 (#2197).
* Internals of `Job` and `AbstractCoroutine` was reworked, resulting in smaller code size, less memory footprint, and better performance (#2513, #2512).
* `CancellationException` from Kotlin standard library is used for cancellation on Kotlin/JS and Kotlin/Native (#2638).
* Introduced new `DelicateCoroutinesApi` annotation that warns users about potential target API pitfalls and suggests studying API's documentation first. The only delicate API right now is `GlobalScope` (#2637).
* Fixed bug introduced in `1.4.3` when `kotlinx-coroutines-core.jar` triggered IDEA debugger failure (#2619).
* Fixed memory leak of `ChildHandlerNode` with reusable continuations (#2564).
* Various documentation improvements (#2555, #2589, #2592, #2583, #2437, #2616, #2633, #2560).
### Changelog relative to version 1.5.0-RC
* Fail-fast during `emitAll` called from cancelled `onCompletion` operator (#2700).
* Flows returned by `stateIn`/`shareIn` keep strong reference to sharing job (#2557).
* Rename internal `TimeSource` to `AbstractTimeSource` due to import issues (#2691).
* Reverted the change that triggered IDEA coroutines debugger crash (#2695, reverted #2291).
* `watchosX64` target support for Kotlin/Native (#2524).
* Various documentation fixes and improvements.
## Version 1.5.0-RC
### Channels API
* Major channels API rework (#330, #974). Existing `offer`, `poll`, and `sendBlocking` methods are deprecated, internal `receiveCatching` and `onReceiveCatching` removed, `receiveOrNull` and `onReceiveOrNull` are completely deprecated. Previously deprecated `SendChannel.isFull` declaration is removed. Channel operators deprecated with `ERROR` are now `HIDDEN`.
* New methods `receiveCatching`, `onReceiveCatching` `trySend`, `tryReceive`, and `trySendBlocking` along with the new result type `ChannelResult` are introduced. They provide better type safety, are less error-prone, and have a consistent future-proof naming scheme. The full rationale behind this change can be found [here](https://github.com/Kotlin/kotlinx.coroutines/issues/974#issuecomment-806569582).
* `BroadcastChannel` and `ConflatedBroadcastChannel` are marked as `ObsoleteCoroutinesApi` in the favor or `SharedFlow` and `StateFlow`. The migration scheme can be found in their documentation. These classes will be deprecated in the next major release.
* `callbackFlow` and `channelFlow` are promoted to stable API.
### Reactive integrations
* All existing API in modules `kotlinx-coroutines-rx2`, `kotlinx-coroutines-rx3`, `kotlinx-coroutines-reactive`, `kotlinx-coroutines-reactor`, and `kotlinx-coroutines-jdk9` were revisited and promoted to stable (#2545).
* `publish` is no longer allowed to emit `null` values (#2646).
* Misleading `awaitSingleOr*` functions on `Publisher` type are deprecated (#2591).
* `MaybeSource.await` is deprecated in the favor of `awaitSingle`, additional lint functions for `Mono` are added in order to prevent ambiguous `Publisher` usages (#2628, #1587).
* `ContextView` support in `kotlinx-coroutines-reactor` (#2575).
* All reactive builders no longer ignore inner cancellation exceptions preventing their completion (#2262, #2646).
* `MaybeSource.collect` and `Maybe.collect` properly finish when they are completed without a value (#2617).
* All exceptions are now consistently handled according to reactive specification, whether they are considered 'fatal' or not by reactive frameworks (#2646).
### Other improvements
* `Flow.last` and `Flow.lastOrNull` operators (#2246).
* `Flow.runningFold` operator (#2641).
* `CoroutinesTimeout` rule for JUnit5 (#2197).
* Internals of `Job` and `AbstractCoroutine` was reworked, resulting in smaller code size, less memory footprint, and better performance (#2513, #2512).
* `CancellationException` from Kotlin standard library is used for cancellation on Kotlin/JS and Kotlin/Native (#2638).
* Introduced new `DelicateCoroutineApi` annotation that warns users about potential target API pitfalls and suggests studying API's documentation first. The only delicate API right now is `GlobalScope` (#2637).
* Fixed bug introduced in `1.4.3` when `kotlinx-coroutines-core.jar` triggered IDEA debugger failure (#2619).
* Fixed memory leak of `ChildHandlerNode` with reusable continuations (#2564).
* Various documentation improvements (#2555, #2589, #2592, #2583, #2437, #2616, #2633, #2560).
## Version 1.4.3
### General changes
* Thread context is properly preserved and restored for coroutines without `ThreadContextElement` (#985)
* `ThreadContextElement`s are now restored in the opposite order from update (#2195)
* Improved performance of combine with 4 parameters, thanks to @alexvanyo (#2419)
* Debug agent sanitizer leaves at least one frame with source location (#1437)
* Update Reactor version in `kotlinx-coroutines-reactor` to `3.4.1`, thanks to @sokomishalov (#2432)
* `callInPlace` contract added to `ReceiveChannel.consume` (#941)
* `CoroutineStart.UNDISPATCHED` promoted to stable API (#1393)
* Kotlin updated to 1.4.30
* `kotlinx.coroutines` are now released directly to MavenCentral
* Reduced the size of `DispatchedCoroutine` by a field
* Internal class `TimeSource` renamed to `SchedulerTimeSource` to prevent wildcard import issues (#2537)
### Bug fixes
* Fixed the problem that prevented implementation via delegation for `Job` interface (#2423)
* Fixed incorrect ProGuard rules that allowed shrinking volatile felds (#1564)
* Fixed `await`/`asDeferred` for `MinimalStage` implementations in jdk8 module (#2456)
* Fixed bug when `onUndeliveredElement` wasn't called for unlimited channels (#2435)
* Fixed a bug when `ListenableFuture.isCancelled` returned from `asListenableFuture` could have thrown an exception, thanks to @vadimsemenov (#2421)
* Coroutine in `callbackFlow` and `produce` is properly cancelled when the channel was closed separately (#2506)
## Version 1.4.2
* Fixed `StackOverflowError` in `Job.toString` when `Job` is observed in its intermediate state (#2371).
* Improved liveness and latency of `Dispatchers.Default` and `Dispatchers.IO` in low-loaded mode (#2381).
* Improved performance of consecutive `Channel.cancel` invocations (#2384).
* `SharingStarted` is now `fun` interface (#2397).
* Additional lint settings for `SharedFlow` to catch programmatic errors early (#2376).
* Fixed bug when mutex and semaphore were not released during cancellation (#2390, thanks to @Tilps for reproducing).
* Some corner cases in cancellation propagation between coroutines and listenable futures are repaired (#1442, thanks to @vadimsemenov).
* Fixed unconditional cast to `CoroutineStackFrame` in exception recovery that triggered failures of instrumented code (#2386).
* Platform-specific dependencies are removed from `kotlinx-coroutines-javafx` (#2360).
## Version 1.4.1
This is a patch release with an important fix to the `SharedFlow` implementation.
* SharedFlow: Fix scenario with concurrent emitters and cancellation of subscriber (#2359, thanks to @vehovsky for the bug report).
## Version 1.4.0
### Improvements
* `StateFlow`, `SharedFlow` and corresponding operators are promoted to stable API (#2316).
* `Flow.debounce` operator with timeout selector based on each individual element is added (#1216, thanks to @mkano9!).
* `CoroutineContext.job` extension property is introduced (#2159).
* `Flow.combine operator` is reworked:
* Complete fairness is maintained for single-threaded dispatchers.
* Its performance is improved, depending on the use-case, by at least 50% (#2296).
* Quadratic complexity depending on the number of upstream flows is eliminated (#2296).
* `crossinline` and `inline`-heavy internals are removed, fixing sporadic SIGSEGV on Mediatek Android devices (#1683, #1743).
* `Flow.zip` operator performance is improved by 40%.
* Various API has been promoted to stable or its deprecation level has been raised (#2316).
### Bug fixes
* Suspendable `stateIn` operator propagates exception to the caller when upstream fails to produce initial value (#2329).
* Fix `SharedFlow` with replay for subscribers working at different speed (#2325).
* Do not fail debug agent installation when security manager does not provide access to system properties (#2311).
* Cancelled lazy coroutines are properly cleaned up from debug agent output (#2294).
* `BlockHound` false-positives are correctly filtered out (#2302, #2190, #2303).
* Potential crash during a race between cancellation and upstream in `Observable.asFlow` is fixed (#2104, #2299, thanks to @LouisCAD and @drinkthestars).
## Version 1.4.0-M1
### Breaking changes
* The concept of atomic cancellation in channels is removed. All operations in channels
and corresponding `Flow` operators are cancellable in non-atomic way (#1813).
* If `CoroutineDispatcher` throws `RejectedExecutionException`, cancel current `Job` and schedule its execution to `Dispatchers.IO` (#2003).
* `CancellableContinuation.invokeOnCancellation` is invoked if the continuation was cancelled while its resume has been dispatched (#1915).
* `Flow.singleOrNull` operator is aligned with standard library and does not longer throw `IllegalStateException` on multiple values (#2289).
### New experimental features
* `SharedFlow` primitive for managing hot sources of events with support of various subscription mechanisms, replay logs and buffering (#2034).
* `Flow.shareIn` and `Flow.stateIn` operators to transform cold instances of flow to hot `SharedFlow` and `StateFlow` respectively (#2047).
### Other
* Support leak-free closeable resources transfer via `onUndeliveredElement` in channels (#1936).
* Changed ABI in reactive integrations for Java interoperability (#2182).
* Fixed ProGuard rules for `kotlinx-coroutines-core` (#2046, #2266).
* Lint settings were added to `Flow` to avoid accidental capturing of outer `CoroutineScope` for cancellation check (#2038).
### External contributions
* Allow nullable types in `Flow.firstOrNull` and `Flow.singleOrNull` by @ansman (#2229).
* Add `Publisher.awaitSingleOrDefault|Null|Else` extensions by @sdeleuze (#1993).
* `awaitCancellation` top-level function by @LouisCAD (#2213).
* Significant part of our Gradle build scripts were migrated to `.kts` by @turansky.
Thank you for your contributions and participation in the Kotlin community!
## Version 1.3.9
* Support of `CoroutineContext` in `Flow.asPublisher` and similar reactive builders (#2155).
* Kotlin updated to 1.4.0.
* Transition to new HMPP publication scheme for multiplatform usages:
* Artifacts `kotlinx-coroutines-core-common` and `kotlinx-coroutines-core-native` are removed.
* For multiplatform usages, it's enough to [depend directly](README.md#multiplatform) on `kotlinx-coroutines-core` in `commonMain` source-set.
* The same artifact coordinates can be used to depend on platform-specific artifact in platform-specific source-set.
## Version 1.3.8
### New experimental features
* Added `Flow.transformWhile operator` (#2065).
* Replaced `scanReduce` with `runningReduce` to be consistent with the Kotlin standard library (#2139).
### Bug fixes and improvements
* Improve user experience for the upcoming coroutines debugger (#2093, #2118, #2131).
* Debugger no longer retains strong references to the running coroutines (#2129).
* Fixed race in `Flow.asPublisher` (#2109).
* Fixed `ensureActive` to work in the empty context case to fix `IllegalStateException` when using flow from `suspend fun main` (#2044).
* Fixed a problem with `AbortFlowException` in the `Flow.first` operator to avoid erroneous `NoSuchElementException` (#2051).
* Fixed JVM dependency on Android annotations (#2075).
* Removed keep rules mentioning `kotlinx.coroutines.android` from core module (#2061 by @mkj-gram).
* Corrected some docs and examples (#2062, #2071, #2076, #2107, #2098, #2127, #2078, #2135).
* Improved the docs and guide on flow cancellation (#2043).
* Updated Gradle version to `6.3` (it only affects multiplatform artifacts in this release).
## Version 1.3.7
* Fixed problem that triggered Android Lint failure (#2004).
* New `Flow.cancellable()` operator for cooperative cancellation (#2026).
* Emissions from `flow` builder now check cancellation status and are properly cancellable (#2026).
* New `currentCoroutineContext` function to use unambiguously in the contexts with `CoroutineScope` in receiver position (#2026).
* `EXACTLY_ONCE` contract support in coroutine builders.
* Various documentation improvements.
## Version 1.3.6
### Flow
* `StateFlow`, new primitive for state handling (#1973, #1816, #395). The `StateFlow` is designed to eventually replace `ConflatedBroadcastChannel` for state publication scenarios. Please, try it and share your feedback. Note, that Flow-based primitives to publish events will be added later. For events you should continue to either use `BroadcastChannel(1)`, if you put events into the `StateFlow`, protect them from double-processing with flags.
* `Flow.onEmpty` operator is introduced (#1890).
* Behavioural change in `Flow.onCompletion`, it is aligned with `invokeOnCompletion` now and passes `CancellationException` to its cause parameter (#1693).
* A lot of Flow operators have left its experimental status and are promoted to stable API.
### Other
* `runInterruptible` primitive to tie cancellation with thread interruption for blocking calls. Contributed by @jxdabc (#1947).
* Integration module with RxJava3 is introduced. Contributed by @ZacSweers (#1883)
* Integration with [BlockHound](https://github.com/reactor/BlockHound) in `kotlinx-coroutines-debug` module (#1821, #1060).
* Memory leak in ArrayBroadcastChannel is fixed (#1885).
* Behavioural change in `suspendCancellableCoroutine`, cancellation is established before invoking passed block argument (#1671).
* Debug agent internals are moved into `kotlinx-coroutines-core` for better integration with IDEA. It should not affect library users and all the redundant code should be properly eliminated with R8.
* ClassCastException with reusable continuations bug is fixed (#1966).
* More precise scheduler detection for `Executor.asCoroutineDispatcher` (#1992).
* Kotlin updated to 1.3.71.
## Version 1.3.5
* `firstOrNull` operator. Contributed by @bradynpoulsen.
* `java.time` adapters for Flow operators. Contributed by @fvasco.
* `kotlin.time.Duration` support (#1402). Contributed by @fvasco.
* Memory leak with a mix of reusable and non-reusable continuations is fixed (#1855).
* `DebugProbes` are ready for production installation: its performance is increased, the flag to disable creation stacktraces to reduce the footprint is introduced (#1379, #1372).
* Stacktrace recovery workaround for Android 6.0 and earlier bug (#1866).
* New integration module: `kotlinx-coroutines-jdk9` with adapters for `java.util.concurrent.Flow`.
* `BroadcastChannel.close` properly starts lazy coroutine (#1713).
* `kotlinx-coroutines-bom` is published without Gradle metadata.
* Make calls to service loader in reactor integrations optimizable by R8 (#1817).
## Version 1.3.4
### Flow
* Detect missing `awaitClose` calls in `callbackFlow` to make it less error-prone when used with callbacks (#1762, #1770). This change makes `callbackFlow` **different** from `channelFlow`.
* `ReceiveChannel.asFlow` extension is introduced (#1490).
* Enforce exception transparency invariant in `flow` builder (#1657).
* Proper `Dispatcher` support in `Flow` reactive integrations (#1765).
* Batch `Subscription.request` calls in `Flow` reactive integration (#766).
* `ObservableValue.asFlow` added to JavaFx integration module (#1695).
* `ObservableSource.asFlow` added to RxJava2 integration module (#1768).
### Other changes
* `kotlinx-coroutines-core` is optimized for R8, making it much smaller for Android usages (75 KB for `1.3.4` release).
* Performance of `Dispatchers.Default` is improved (#1704, #1706).
* Kotlin is updated to 1.3.70.
* `CoroutineDispatcher` and `ExecutorCoroutineDispatcher` experimental coroutine context keys are introduced (#1805).
* Performance of various `Channel` operations is improved (#1565).
## Version 1.3.3
### Flow
* `Flow.take` performance is significantly improved (#1538).
* `Flow.merge` operator (#1491).
* Reactive Flow adapters are promoted to stable API (#1549).
* Reusable cancellable continuations were introduced that improved the performance of various flow operators and iteration over channels (#1534).
* Fixed interaction of multiple flows with `take` operator (#1610).
* Throw `NoSuchElementException` instead of `UnsupportedOperationException` for empty `Flow` in `reduce` operator (#1659).
* `onCompletion` now rethrows downstream exceptions on emit attempt (#1654).
* Allow non-emitting `withContext` from `flow` builder (#1616).
### Debugging
* `DebugProbes.dumpCoroutines` is optimized to be able to print the 6-digit number of coroutines (#1535).
* Properly capture unstarted lazy coroutines in debugger (#1544).
* Capture coroutines launched from within a test constructor with `CoroutinesTimeout` test rule (#1542).
* Stacktraces of `Job`-related coroutine machinery are shortened and prettified (#1574).
* Stacktrace recovery unification that should provide a consistent experience recover of stacktrace (#1597).
* Stacktrace recovery for `withTimeout` is supported (#1625).
* Do not recover exception with a single `String` parameter constructor that is not a `message` (#1631).
### Other features
* `Dispatchers.Default` and `Dispatchers.IO` rework: CPU consumption is significantly lower, predictable idle threads termination (#840, #1046, #1286).
* Avoid `ServiceLoader` for loading `Dispatchers.Main` (#1572, #1557, #878, #1606).
* Consistently handle undeliverable exceptions in RxJava and Reactor integrations (#252, #1614).
* `yield` support in immediate dispatchers (#1474).
* `CompletableDeferred.completeWith(result: Result<T>)` is introduced.
* Added support for tvOS and watchOS-based Native targets (#1596).
### Bug fixes and improvements
* Kotlin version is updated to 1.3.61.
* `CoroutineDispatcher.isDispatchNeeded` is promoted to stable API (#1014).
* Livelock and stackoverflows in mutual `select` expressions are fixed (#1411, #504).
* Properly handle `null` values in `ListenableFuture` integration (#1510).
* Making ReceiveChannel.cancel linearizability-friendly.
* Linearizability of Channel.close in a complex contended cases (#1419).
* ArrayChannel.isBufferEmpty atomicity is fixed (#1526).
* Various documentation improvements.
* Reduced bytecode size of `kotlinx-coroutines-core`, reduced size of minified `dex` when using basic functionality of `kotlinx-coroutines`.
## Version 1.3.2
This is a maintenance release that does not include any new features or bug fixes.
* Reactive integrations for `Flow` are promoted to stable API.
* Obsolete reactive API is deprecated.
* Deprecation level for API deprecated in 1.3.0 is increased.
* Various documentation improvements.
## Version 1.3.1
This is a minor update with various fixes:
* Flow: Fix recursion in combineTransform<T1, T2, R> (#1466).
* Fixed race in the Semaphore (#1477).
* Repaired some of ListenableFuture.kt's cancellation corner cases (#1441).
* Consistently unwrap exception in slow path of CompletionStage.asDeferred (#1479).
* Various fixes in documentation (#1496, #1476, #1470, #1468).
* Various cleanups and additions in tests.
Note: Kotlin/Native artifacts are now published with Gradle metadata format version 1.0, so you will need
Gradle version 5.3 or later to use this version of kotlinx.coroutines in your Kotlin/Native project.
## Version 1.3.0
### Flow
This version is the first stable release with [`Flow`](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html) API.
All `Flow` API not marked with `@FlowPreview` or `@ExperimentalCoroutinesApi` annotations are stable and here to stay.
Flow declarations marked with `@ExperimentalCoroutinesApi` have [the same guarantees](/docs/topics/compatibility.md#experimental-api) as regular experimental API.
Please note that API marked with `@FlowPreview` have [weak guarantees](/docs/topics/compatibility.md#flow-preview-api) on source, binary and semantic compatibility.
### Changelog
* A new [guide section](/docs/topics/flow.md) about Flow.
* `CoroutineDispatcher.asExecutor` extension (#1450).
* Fixed bug when `select` statement could report the same exception twice (#1433).
* Fixed context preservation in `flatMapMerge` in a case when collected values were immediately emitted to another flow (#1440).
* Reactive Flow integrations enclosing files are renamed for better interoperability with Java.
* Default buffer size in all Flow operators is increased to 64.
* Kotlin updated to 1.3.50.
## Version 1.3.0-RC2
### Flow improvements
* Operators for UI programming are reworked for the sake of consistency, naming scheme for operator overloads is introduced:
* `combineLatest` is deprecated in the favor of `combine`.
* `combineTransform` operator for non-trivial transformations (#1224).
* Top-level `combine` and `combineTransform` overloads for multiple flows (#1262).
* `switchMap` is deprecated. `flatMapLatest`, `mapLatest` and `transformLatest` are introduced instead (#1335).
* `collectLatest` terminal operator (#1269).
* Improved cancellation support in `flattenMerge` (#1392).
* `channelFlow` cancellation does not leak to the parent (#1334).
* Fixed flow invariant enforcement for `suspend fun main` (#1421).
* `delayEach` and `delayFlow` are deprecated (#1429).
### General changes
* Integration with Reactor context
* Propagation of the coroutine context of `await` calls into Mono/Flux builder.
* Publisher.asFlow propagates coroutine context from `collect` call to the Publisher.
* New `Flow.asFlux ` builder.
* ServiceLoader-code is adjusted to avoid I/O on the Main thread on newer (3.6.0+) Android toolchain.
* Stacktrace recovery support for minified builds on Android (#1416).
* Guava version in `kotlinx-coroutines-guava` updated to `28.0`.
* `setTimeout`-based JS dispatcher for platforms where `process` is unavailable (#1404).
* Native, JS and common modules are added to `kotlinx-coroutines-bom`.
* Fixed bug with ignored `acquiredPermits` in `Semaphore` (#1423).
## Version 1.3.0-RC
### Flow
* Core `Flow` API is promoted to stable
* New basic `Flow` operators: `withIndex`, `collectIndexed`, `distinctUntilChanged` overload
* New core `Flow` operators: `onStart` and `onCompletion`
* `ReceiveChannel.consumeAsFlow` and `emitAll` (#1340)
### General changes
* Kotlin updated to 1.3.41
* Added `kotlinx-coroutines-bom` with Maven Bill of Materials (#1110)
* Reactive integrations are seriously improved
* All builders now are top-level functions instead of extensions on `CoroutineScope` and prohibit `Job` instance in their context to simplify lifecycle management
* Fatal exceptions are handled consistently (#1297)
* Integration with Reactor Context added (#284)
* Stacktrace recovery for `suspend fun main` (#1328)
* `CoroutineScope.cancel` extension with message (#1338)
* Protection against non-monotonic clocks in `delay` (#1312)
* `Duration.ZERO` is handled properly in JDK 8 extensions (#1349)
* Library code is adjusted to be more minification-friendly
## Version 1.3.0-M2
* Kotlin updated to 1.3.40.
* `Flow` exception transparency concept.
* New declarative `Flow` operators: `onCompletion`, `catch`, `retryWhen`, `launchIn`. `onError*` operators are deprecated in favour of `catch`. (#1263)
* `Publisher.asFlow` is integrated with `buffer` operator.
* `Publisher.openSubscription` default request size is `1` instead of `0` (#1267).
## Version 1.3.0-M1
Flow:
* Core `Flow` interfaces and operators are graduated from preview status to experimental.
* Context preservation invariant rework (#1210).
* `channelFlow` and `callbackFlow` replacements for `flowViaChannel` for concurrent flows or callback-based APIs.
* `flow` prohibits emissions from non-scoped coroutines by default and recommends to use `channelFlow` instead to avoid most of the concurrency-related bugs.
* Flow cannot be implemented directly
* `AbstractFlow` is introduced for extension (e.g. for managing state) and ensures all context preservation invariants.
* Buffer size is decoupled from all operators that imply channel usage (#1233)
* `buffer` operator can be used to adjust buffer size of any buffer-dependent operator (e.g. `channelFlow`, `flowOn` and `flatMapMerge`).
* `conflate` operator is introduced.
* Flow performance is significantly improved.
* New operators: `scan`, `scanReduce`, `first`, `emitAll`.
* `flowWith` and `flowViaChannel` are deprecated.
* `retry` ignores cancellation exceptions from upstream when the flow was externally cancelled (#1122).
* `combineLatest` overloads for multiple flows (#1193).
* Fixed numerical overflow in `drop` operator.
Channels:
* `consumeEach` is promoted to experimental API (#1080).
* Conflated channels always deliver the latest value after closing (#332, #1235).
* Non-suspending `ChannelIterator.next` to improve iteration performance (#1162).
* Channel exception types are consistent with `produce` and are no longer swallowed as cancellation exceptions in case of programmatic errors (#957, #1128).
* All operators on channels (that were prone to coroutine leaks) are deprecated in the favor of `Flow`.
General changes:
* Kotlin updated to 1.3.31
* `Semaphore` implementation (#1088)
* Loading of `Dispatchers.Main` is tweaked so the latest version of R8 can completely remove I/O when loading it (#1231).
* Performace of all JS dispatchers is significantly improved (#820).
* `withContext` checks cancellation status on exit to make reasoning about sequential concurrent code easier (#1177).
* Consistent exception handling mechanism for complex hierarchies (#689).
* Convenient overload for `CoroutinesTimeout.seconds` (#1184).
* Fix cancellation bug in onJoin (#1130).
* Prevent internal names clash that caused errors for ProGuard (#1159).
* POSIX's `nanosleep` as `delay` in `runBlocking ` in K/N (#1225).
## Version 1.2.2
* Kotlin updated to 1.3.40.
## Version 1.2.1
Major:
* Infrastructure for testing coroutine-specific code in `kotlinx-coroutines-test`: `runBlockingTest`, `TestCoroutineScope` and `TestCoroutineDispatcher`, contributed by Sean McQuillan (@objcode). Obsolete `TestCoroutineContext` from `kotlinx-coroutines-core` is deprecated.
* `Job.asCompletableFuture` extension in jdk8 module (#1113).
Flow improvements:
* `flowViaChannel` rework: block parameter is no longer suspending, but provides `CoroutineScope` receiver and allows conflated channel (#1081, #1112).
* New operators: `switchMap`, `sample`, `debounce` (#1107).
* `consumerEach` is deprecated on `Publisher`, `ObservableSource` and `MaybeSource`, `collect` extension is introduced instead (#1080).
Other:
* Race in Job.join and concurrent cancellation is fixed (#1123).
* Stacktrace recovery machinery improved: cycle detection works through recovered exceptions, cancellation exceptions are recovered on cancellation fast-path.
* Atomicfu-related bug fixes: publish transformed artifacts, do not propagate transitive atomicfu dependency (#1064, #1116).
* Publication to NPM fixed (#1118).
* Misplaced resources are removed from the final jar (#1131).
## Version 1.2.0
* Kotlin updated to 1.3.30.
* New API: `CancellableContinuation.resume` with `onCancelling` lambda (#1044) to consistently handle closeable resources.
* Play services task version updated to 16.0.1.
* `ReceiveChannel.isEmpty` is no longer deprecated
A lot of `Flow` improvements:
* Purity property is renamed to context preservation and became more restrictive.
* `zip` and `combineLatest` operators.
* Integration with RxJava2
* `flatMap`, `merge` and `concatenate` are replaced with `flattenConcat`, `flattenMerge`, `flatMapConcat` and `flatMapMerge`.
* Various documentation improvements and minor bug fixes.
Note that `Flow` **is not** leaving its [preview status](/docs/topics/compatibility.md#flow-preview-api).
## Version 1.2.0-alpha-2
This release contains major [feature preview](/docs/topics/compatibility.md#flow-preview-api): cold streams aka `Flow` (#254).
Performance:
* Performance of `Dispatcher.Main` initialization is significantly improved (#878).
## Version 1.2.0-alpha
* Major debug agent improvements. Real stacktraces are merged with coroutine stacktraces for running coroutines, merging heuristic is improved, API is cleaned up and is on its road to stabilization (#997).
* `CoroutineTimeout` rule or JUnit4 is introduced to simplify coroutines debugging (#938).
* Stacktrace recovery improvements. Exceptions with custom properties are no longer copied, `CopyableThrowable` interface is introduced, machinery is [documented](https://github.com/Kotlin/kotlinx.coroutines/blob/develop/docs/debugging.md) (#921, #950).
* `Dispatchers.Unconfined`, `MainCoroutineDispatcher.immediate`, `MainScope` and `CoroutineScope.cancel` are promoted to stable API (#972).
* `CompletableJob` is introduced (#971).
* Structured concurrency is integrated into futures and listenable futures (#1008).
* `ensurePresent` and `isPresent` extensions for `ThreadLocal` (#1028).
* `ensureActive` extensions for `CoroutineContext`, `CoroutineScope` and `Job` (#963).
* `SendChannel.isFull` and `ReceiveChannel.isEmpty` are deprecated (#1053).
* `withContext` checks cancellation on entering (#962).
* Operator `invoke` on `CoroutineDispatcher` (#428).
* Java 8 extensions for `delay` and `withTimeout` now properly handle too large values (#428).
* A global exception handler for fatal exceptions in coroutines is introduced (#808, #773).
* Major improvements in cancellation machinery and exceptions delivery consistency. Cancel with custom exception is completely removed.
* Kotlin version is updated to 1.3.21.
* Do not use private API on newer Androids to handle exceptions (#822).
Bug fixes:
* Proper `select` support in debug agent (#931).
* Proper `supervisorScope` support in debug agent (#915).
* Throwing `initCause` does no longer trigger an internal error (#933).
* Lazy actors are started when calling `close` in order to cleanup their resources (#939).
* Minor bugs in reactive integrations are fixed (#1008).
* Experimental scheduler shutdown sequence is fixed (#990).
## Version 1.1.1
* Maintenance release, no changes in the codebase
* Kotlin is updated to 1.3.20
* Gradle is updated to 4.10
* Native module is published with Gradle metadata v0.4
## Version 1.1.0
* Kotlin version updated to 1.3.11.
* Resumes to `CancellableContinuation` in the final state produce `IllegalStateException` (#901). This change does not affect #830, races between resume and cancellation do not lead to an exceptional situation.
* `runBlocking` is integrated with `Dispatchers.Unconfined` by sharing an internal event loop. This change does not affect the semantics of the previously correct code but allows to mix multiple `runBlocking` and unconfined tasks (#860).
## Version 1.1.0-alpha
### Major improvements in coroutines testing and debugging
* New module: [`kotlinx-coroutines-debug`](https://github.com/Kotlin/kotlinx.coroutines/blob/master/core/kotlinx-coroutines-debug/README.md). Debug agent that improves coroutines stacktraces, allows to print all active coroutines and its hierarchies and can be installed as Java agent.
* New module: [`kotlinx-coroutines-test`](https://github.com/Kotlin/kotlinx.coroutines/blob/master/core/kotlinx-coroutines-test/README.md). Allows setting arbitrary `Dispatchers.Main` implementation for tests (#810).
* Stacktrace recovery mechanism. Exceptions from coroutines are recovered from current coroutine stacktraces to simplify exception diagnostic. Enabled in debug mode, controlled by `kotlinx.coroutines.debug` system property (#493).
### Other improvements
* `MainScope` factory and `CoroutineScope.cancel` extension (#829). One line `CoroutineScope` integration!
* `CancellableContinuation` race between `resumeWithException` and `cancel` is addressed, exceptions during cancellation are no longer reported to exception handler (#830, #892).
* `Dispatchers.Default` now consumes much less CPU on JVM (#840).
* Better diagnostic and fast failure if an uninitialized dispatcher is used (#880).
* Conflated channel becomes linearizable.
* Fixed inconsistent coroutines state when the result of the coroutine had type `DisposableHandle` (#835).
* Fixed `JavaFx` initialization bug (#816).
* `TimeoutCancellationException` is thrown by `withTimeout` instead of `CancellationException` if negative timeout is supplied (#870).
* Kotlin/Native single-threaded workers support: coroutines can be safely used in multiple independent K/N workers.
* jsdom support in `Dispatchers.Default` on JS.
* rxFlowable generic parameter is now restricted with Any.
* Guava 27 support in `kotlinx-coroutines-guava`.
* Coroutines are now built with progressive mode.
* Various fixes in the documentation.
## Version 1.0.1
* Align `publisher` implementation with Reactive TCK.
* Reimplement `future` coroutine builders on top of `AbstractCoroutine` (#751).
* Performance optimizations in `Dispatchers.Default` and `Dispatchers.IO`.
* Use only public API during `JavaFx` instantiation, fixes warnings on Java 9 and build on Java 11 (#463).
* Updated contract of `CancellableContinuation.resumeWithException` (documentation fix, see #712).
* Check cancellation on fast-path of all in-place coroutine builders (`withContext`, `coroutineScope`, `supervisorScope`, `withTimeout` and `withTimeoutOrNull`).
* Add optional prefix to thread names of `ExperimentalCoroutineDispatcher` (#661).
* Fixed bug when `ExperimentalCoroutineDispatcher` could end up in inconsistent state if `Thread` constructor throws an exception (#748).
## Version 1.0.0
* All Kotlin dependencies updated to 1.3 release version.
* Fixed potential memory leak in `HandlerDispatcher.scheduleResumeAfterDelay`, thanks @cbeyls.
* `yield` support for `Unconfined` and immediate dispatchers (#737).
* Various documentation improvements.
## Version 1.0.0-RC1
* Coroutines API is updated to Kotlin 1.3.
* Deprecated API is removed or marked as `internal`.
* Experimental and internal coroutine API is marked with corresponding `kotlin.experimental.Experimental` annotation. If you are using `@ExperimentalCoroutinesApi` or `@InternalCoroutinesApi` you should explicitly opt-in, otherwise compilation warning (or error) will be produced.
* `Unconfined` dispatcher (and all dispatchers which support immediate invocation) forms event-loop on top of current thread, thus preventing all `StackOverflowError`s. `Unconfined` dispatcher is now much safer for the general use and may leave its experimental status soon (#704).
* Significantly improved performance of suspending hot loops in `kotlinx.coroutines` (#537).
* Proguard rules are embedded into coroutines JAR to assist jettifier (#657)
* Fixed bug in shutdown sequence of `runBlocking` (#692).
* `ReceiveChannel.receiveOrNull` is marked as obsolete and deprecated.
* `Job.cancel(cause)` and `ReceiveChannel.cancel(cause)` are deprecated, `cancel()` returns `Unit` (#713).
## Version 0.30.2
* `Dispatchers.Main` is instantiated lazily (see #658 and #665).
* Blocking coroutine dispatcher views are now shutdown properly (#678).
* Prevent leaking Kotlin 1.3 from atomicfu dependency (#659).
* Thread-pool based dispatcher factories are marked as obsolete (#261).
* Fixed exception loss on `withContext` cancellation (#675).
## Version 0.30.1
Maintenance release:
* Added `Dispatchers.Main` to common dispatchers, which can be used from Android, Swing and JavaFx projects if a corresponding integration library is added to dependencies.
* With `Dispatchers.Main` improvement tooling bug in Android Studio #626 is mitigated, so Android users now can safely start the migration to the latest `kotlinx.coroutines` version.
* Fixed bug with thread unsafety of shutdown sequence in `EventLoop`.
* Experimental coroutine dispatcher now has `close` contract similar to Java `Executor`, so it can be safely instantiated and closed multiple times (affects only unit tests).
* Atomicfu version is updated with fixes in JS transformer (see #609)
## Version 0.30.0
* **[Major]** Further improvements in exception handling — no failure exception is lost.
* `async` and async-like builders cancel parent on failure (it affects `CompletableDeferred`, and all reactive integration builders).
* This makes parallel decomposition exception-safe and reliable without having to rember about `awaitAll` (see #552).
* `Job()` wih parent now also cancels parent on failure consistently with other scopes.
* All coroutine builders and `Job` implementations propagate failure to the parent unless it is a `CancellationException`.
* Note, "scoping" builders don't "cancel the parent" verbatim, but rethrow the corresponding exception to the caller for handling.
* `SupervisorJob()` and `supervisorScope { ... }` are introduced, allowing for a flexible implementation of custom exception-handling policies, see a [new section in the guide on supervision](docs/topics/exception-handling.md#supervision).
* Got rid of `awaitAll` in documentation and rewrote `currentScope` section (see #624).
* **[Major]** Coroutine scheduler is used for `Dispatchers.Default` by default instead of deprecated `CommonPool`.
* "`DefaultDispatcher`" is used as a public name of the default impl (you'll see it thread names and in the guide).
* `-Dkotlinx.coroutines.scheduler=off` can be used to switch back to `CommonPool` for a time being (until deprecated CommonPool is removed).
* Make `CoroutineStart.ATOMIC` experimental as it covers important use-case with resource cleanup in finally block (see #627).
* Restored binary compatibility of `Executor.asCoroutineDispatcher` (see #629).
* Fixed OOM in thread-pool dispatchers (see #571).
* Check for cancellation when starting coroutine with `Dispatchers.Unconfined` (see #621).
* A bunch of various performance optimizations and docs fixes, including contributions from @AlexanderPrendota, @PaulWoitaschek.
## Version 0.27.0
* **[Major]** Public API revision. All public API was reviewed and marked as preparation to `1.0` release:
1. `@Deprecated` API. All API marked as deprecated will be removed in 1.0 release without replacement.
2. `@ExperimentalCoroutinesApi` API. This API is experimental and may change in the future, but migration mechanisms will be provided. Signature, binary compatibility and semantics can be changed.
3. `@InternalCoroutinesApi`. This API is intended to be used **only** from within `kotlinx.coroutines`. It can and will be changed, broken
and removed in the future releases without any warnings and migration aids. If you find yourself using this API, it is better to report
your use-case to Github issues, so decent, stable and well-tested alternative can be provided.
4. `@ObsoleteCoroutinesApi`. This API has serious known flaws and will be replaced with a better alternative in the nearest releases.
5. Regular public API. This API is proven to be stable and is not going to be changed. If at some point it will be discovered that such API
has unfixable design flaws, it will be gradually deprecated with proper replacement and migration aid, but won't be removed for at least a year.
* **[Major]** Job state machine is reworked. It includes various performance improvements, fixes in
data-races which could appear in a rare circumstances and consolidation of cancellation and exception handling.
Visible consequences of include more robust exception handling for large coroutines hierarchies and for different kinds of `CancellationException`, transparent parallel decomposition and consistent view of coroutines hierarchy in terms of its state (see #220 and #585).
* NIO, Quasar and Rx1 integration modules are removed with no replacement (see #595, #601, #603).
* `withContext` is now aligned with structured concurrency and awaits for all launched tasks, its performance is significantly improved (see #553 and #617).
* Added integration module with Play Services Task API. Thanks @SUPERCILEX and @lucasvalenteds for the contribution!
* Integration with Rx2 now respects nullability in type constraints (see #347). Thanks @Dmitry-Borodin for the contribution!
* `CompletableFuture.await` and `ListenableFuture.await` now propagate cancellation to the future (see #611).
* Cancellation of `runBlocking` machinery is improved (see #589).
* Coroutine guide is restructured and split to multiple files for the sake of simplicity.
* `CoroutineScope` factory methods add `Job` if it is missing from the context to enforce structured concurrency (see #610).
* `Handler.asCoroutineDispatcher` has a `name` parameter for better debugging (see #615).
* Fixed bug when `CoroutineSchedule` was closed from one of its threads (see #612).
* Exceptions from `CoroutineExceptionHandler` are reported by default exception handler (see #562).
* `CoroutineName` is now available from common modules (see #570).
* Update to Kotlin 1.2.70.
## Version 0.26.1
* Android `Main` dispatcher is `async` by default which may significantly improve UI performance. Contributed by @JakeWharton (see #427).
* Fixed bug when lazily-started coroutine with registered cancellation handler was concurrently started and cancelled.
* Improved termination sequence in IO dispatcher.
* Fixed bug with `CoroutineScope.plus` operator (see #559).
* Various fixes in the documentation. Thanks to @SUPERCILEX, @yorlov, @dualscyther and @soudmaijer!
## Version 0.26.0
* Major rework of `kotlinx.coroutines` concurrency model (see #410 for a full explanation of the rationale behind this change):
* All coroutine builders are now extensions on `CoroutineScope` and inherit its `coroutineContext`. Standalone builders are deprecated.
* As a consequence, all nested coroutines launched via builders now automatically establish parent-child relationship and inherit `CoroutineDispatcher`.
* All coroutine builders use `Dispatchers.Default` by default if `CoroutineInterceptor` is not present in their context.
* [CoroutineScope](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html) became the first-class citizen in `kolinx.coroutines`.
* `withContext` `block` argument has `CoroutineScope` as a receiver.
* [GlobalScope](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-global-scope/index.html) is introduced to simplify migration to new API and to launch global-level coroutines.
* `currentScope` and `coroutineScope` builders are introduced to extract and provide `CoroutineScope`.
* Factory methods to create `CoroutineScope` from `CoroutineContext` are introduced.
* `CoroutineScope.isActive` became an extension property.
* New sections about structured concurrency in core guide: ["Structured concurrency"](docs/topics/coroutines-guide.md#structured-concurrency), ["Scope builder"](docs/topics/coroutines-guide.md#scope-builder) and ["Structured concurrency with async"](docs/topics/coroutines-guide.md#structured-concurrency-with-async).
* New section in UI guide with Android example: ["Structured concurrency, lifecycle and coroutine parent-child hierarchy"](ui/coroutines-guide-ui.md#structured-concurrency,-lifecycle-and-coroutine-parent-child-hierarchy).
* Deprecated reactive API is removed.
* Dispatchers are renamed and grouped in the Dispatchers object (see #41 and #533):
* Dispatcher names are consistent.
* Old dispatchers including `CommonPool` are deprecated.
* Fixed bug with JS error in rare cases in `invokeOnCompletion(onCancelling = true)`.
* Fixed loading of Android exception handler when `Thread.contextClassLoader` is mocked (see #530).
* Fixed bug when `IO` dispatcher silently hung (see #524 and #525) .
## Version 0.25.3
* Distribution no longer uses multi-version jar which is not supported on Android (see #510).
* JS version of the library does not depend on AtomicFu anymore:
All the atomic boxes in JS are fully erased.
* Note that versions 0.25.1-2 are skipped for technical reasons (they were not fully released).
## Version 0.25.0
* Major rework on exception-handling and cancellation in coroutines (see #333, #452 and #451):
* New ["Exception Handling" section in the guide](docs/topics/coroutines-guide.md#exception-handling) explains exceptions in coroutines.
* Semantics of `Job.cancel` resulting `Boolean` value changed — `true` means exception was handled by the job, caller shall handle otherwise.
* Exceptions are properly propagated from children to parents.
* Installed `CoroutineExceptionHandler` for a family of coroutines receives one aggregated exception in case of failure.
* Change `handleCoroutineException` contract, so custom exception handlers can't break coroutines machinery.
* Unwrap `JobCancellationException` properly to provide exception transparency over whole call chain.
* Introduced support for thread-local elements in coroutines context (see #119):
* `ThreadContextElement` API for custom thread-context sensitive context elements.
* `ThreadLocal.asContextElement()` extension function to convert an arbitrary thread-local into coroutine context element.
* New ["Thread-local data" subsection in the guide](docs/topics/coroutines-guide.md#thread-local-data) with examples.
* SLF4J Mapped Diagnostic Context (MDC) integration is provided via `MDCContext` element defined in [`kotlinx-coroutines-slf4j`](integration/kotlinx-coroutines-slf4j/README.md) integration module.
* Introduced IO dispatcher to offload blocking I/O-intensive tasks (see #79).
* Introduced `ExecutorCoroutineDispatcher` instead of `CloseableCoroutineDispatcher` (see #385).
* Built with Kotlin 1.2.61 and Kotlin/Native 0.8.2.
* JAR files for `kotlinx-coroutines` are now [JEP 238](https://openjdk.java.net/jeps/238) multi-release JAR files.
* On JDK9+ `VarHandle` is used for atomic operations instead of `Atomic*FieldUpdater` for better performance.
* See [AtomicFu](https://github.com/Kotlin/kotlinx.atomicfu/blob/master/README.md) project for details.
* Reversed addition of `BlockingChecker` extension point to control where `runBlocking` can be used (see #227).
* `runBlocking` can be used anywhere without limitations (again), but it would still cause problems if improperly used on UI thread.
* Corrected return-type of `EventLoop` pseudo-constructor (see #477, PR by @Groostav).
* Fixed `as*Future()` integration functions to catch all `Throwable` exceptions (see #469).
* Fixed `runBlocking` cancellation (see #501).
* Fixed races and timing bugs in `withTimeoutOrNull` (see #498).
* Execute `EventLoop.invokeOnTimeout` in `DefaultDispatcher` to allow busy-wait loops inside `runBlocking` (see #479).
* Removed `kotlinx-coroutines-io` module from the project, it has moved to [kotlinx-io](https://github.com/kotlin/kotlinx-io/).
* Provide experimental API to create limited view of experimental dispatcher (see #475).
* Various minor fixes by @LouisCAD, @Dmitry-Borodin.
## Version 0.24.0
* Fully multiplatform release with Kotlin/Native support (see #246):
* Only single-threaded operation inside `runBlocking` event loop is supported at this moment.
* See details on setting up build environment [here](native/README.md).
* Improved channels:
* Introduced `SendChannel.invokeOnClose` (see #341).
* Make `close`, `cancel`, `isClosedForSend`, `isClosedForReceive` and `offer` linearizable with other operations (see #359).
* Fixed bug when send operation can be stuck in channel forever.
* Fixed broadcast channels on JS (see #412).
* Provides `BlockingChecker` mechanism which checks current context (see #227).
* Attempts to use `runBlocking` from any supported UI thread (Android, JavaFx, Swing) will result in exception.
* Android:
* Worked around Android bugs with zero-size ForkJoinPool initialization (see #432, #288).
* Introduced `UI.immediate` extension as performance-optimization to immediately execute tasks which are invoked from the UI thread (see #381).
* Use it only when absolutely needed. It breaks asynchrony of coroutines and may lead to surprising and unexpected results.
* Fixed materialization of a `cause` exception for `Job` onCancelling handlers (see #436).
* Fixed JavaFx `UI` on Java 9 (see #443).
* Fixed and documented the order between cancellation handlers and continuation resume (see #415).
* Fixed resumption of cancelled continuation (see #450).
* Includes multiple fixes to documentation contributed by @paolop, @SahilLone, @rocketraman, @bdavisx, @mtopolnik, @Groostav.
* Experimental coroutines scheduler preview (JVM only):
* Written from scratch and optimized for communicating coroutines.
* Performs significantly better than ForkJoinPool on coroutine benchmarks and for connected applications with [ktor](https://ktor.io).
* Supports automatic creating of new threads for blocking operations running on the same thread pool (with an eye on solving #79), but there is no stable public API for it just yet.
* For preview, run JVM with `-Dkotlinx.coroutines.scheduler` option. In this case `DefaultDispatcher` is set to new experimental scheduler instead of FJP-based `CommonPool`.
* Submit your feedback to issue #261.
## Version 0.23.4
* Recompiled with Kotlin 1.2.51 to solve broken metadata problem (see [KT-24944](https://youtrack.jetbrains.com/issue/KT-24944)).
## Version 0.23.3
* Kotlin 1.2.50.
* JS: Moved to atomicfu version 0.10.3 that properly matches NPM & Kotlin/JS module names (see #396).
* Improve source-code compatibility with previous (0.22.x) version of `openChannel().use { ... }` pattern by providing deprecated extension function `use` on `ReceiveChannel`.
## Version 0.23.2
* IO: fix joining and continuous writing byte array interference.
## Version 0.23.1
* JS: Fix dependencies in NPM: add "kotlinx-atomicfu" dependency (see #370).
* Introduce `broadcast` coroutine builder (see #280):
* Support `BroadcastChannel.cancel` method to drop the buffer.
* Introduce `ReceiveChannel.broadcast()` extension.
* Fixed a bunch of doc typos (PRs by @paolop).
* Corrected previous version's release notes (PR by @ansman).
## Version 0.23.0
* Kotlin 1.2.41
* **Coroutines core module is made mostly cross-platform for JVM and JS**:
* Migrate channels and related operators to common, so channels can be used from JS (see #201).
* Most of the code is shared between JVM and JS versions using cross-platform version of [AtomicFU](https://github.com/Kotlin/kotlinx.atomicfu) library.
* The recent version of Kotlin allows default parameters in common code (see #348).
* The project is built using Gradle 4.6.
* **Breaking change**: `CancellableContinuation` is not a `Job` anymore (see #219):
* It does not affect casual users of `suspendCancellableCoroutine`, since all the typically used functions are still there.
* `CancellableContinuation.invokeOnCompletion` is deprecated now and its semantics had subtly changed:
* `invokeOnCancellation` is a replacement for `invokeOnCompletion` to install a handler.
* The handler is **not** invoked on `resume` which corresponds to the typical usage pattern.
* There is no need to check for `cont.isCancelled` in a typical handler code anymore (since handler is invoked only when continuation is cancelled).
* Multiple cancellation handlers cannot be installed.
* Cancellation handlers cannot be removed (disposed of) anymore.
* This change is designed to allow better performance of suspending cancellable functions:
* Now `CancellableContinuation` implementation has simpler state machine and is implemented more efficiently.
* Exception handling in `AbstractContinuation` (that implements `CancellableContinuation`) is now consistent:
* Always prefer exception thrown from coroutine as exceptional reason, add cancellation cause as suppressed exception.
* **Big change**: Deprecate `CoroutineScope.coroutineContext`:
* It is replaced with top-level `coroutineContext` function from Kotlin standard library.
* Improve `ReceiveChannel` operators implementations to guarantee closing of the source channels under all circumstances (see #279):
* `onCompletion` parameter added to `produce` and all other coroutine builders.
* Introduce `ReceiveChannel.consumes(): CompletionHandler` extension function.
* Replace `SubscriptionReceiveChannel` with `ReceiveChannel` (see #283, PR by @deva666).
* `ReceiveChannel.use` extension is introduced to preserve source compatibility, but is deprecated.
* `consume` or `consumeEach` extensions should be used for channels.
* When writing operators, `produce(onCompletion=consumes()) { ... }` pattern shall be used (see #279 above).
* JS: Kotlin is declared as peer dependency (see #339, #340, PR by @ansman).
* Invoke exception handler for actor on cancellation even when channel was successfully closed, so exceptions thrown by actor are always reported (see #368).
* Introduce `awaitAll` and `joinAll` for `Deferred` and `Job` lists correspondingly (see #171).
* Unwrap `CompletionException` exception in `CompletionStage.await` slow-path to provide consistent results (see #375).
* Add extension to `ExecutorService` to return `CloseableCoroutineDispatcher` (see #278, PR by @deva666).
* Fail with proper message during build if JDK_16 is not set (see #291, PR by @venkatperi).
* Allow negative timeouts in `delay`, `withTimeout` and `onTimeout` (see #310).
* Fix a few bugs (leaks on cancellation) in `delay`:
* Invoke `clearTimeout` on cancellation in JSDispatcher.
* Remove delayed task on cancellation from internal data structure on JVM.
* Introduce `ticker` function to create "ticker channels" (see #327):
* It provides analogue of RX `Observable.timer` for coroutine channels.
* It is currently supported on JVM only.
* Add a test-helper class `TestCoroutineContext` (see #297, PR by @streetsofboston).
* It is currently supported on JVM only.
* Ticker channels (#327) are not yet compatible with it.
* Implement a better way to set `CoroutineContext.DEBUG` value (see #316, PR by @dmytrodanylyk):
* Made `CoroutineContext.DEBUG_PROPERTY_NAME` constant public.
* Introduce public constants with `"on"`, `"off"`, `"auto"` values.
* Introduce system property to control `CommonPool` parallelism (see #343):
* `CommonPool.DEFAULT_PARALLELISM_PROPERTY_NAME` constant is introduced with a value of "kotlinx.coroutines.default.parallelism".
* Include package-list files into documentation site (see #290).
* Fix various typos in docs (PRs by @paolop and @ArtsiomCh).
## Version 0.22.5
* JS: Fixed main file reference in [NPM package](https://www.npmjs.com/package/kotlinx-coroutines-core)
* Added context argument to `Channel.filterNot` (PR by @jcornaz).
* Implemented debug `toString` for channels (see #185).
## Version 0.22.4
* JS: Publish to NPM (see #229).
* JS: Use node-style dispatcher on ReactNative (see #236).
* [jdk8 integration](integration/kotlinx-coroutines-jdk8/README.md) improvements:
* Added conversion from `CompletionStage` to `Deferred` (see #262, PR by @jcornaz).
* Use fast path in `CompletionStage.await` and make it cancellable.
## Version 0.22.3
* Fixed `produce` builder to close the channel on completion instead of cancelling it, which lead to lost elements with buffered channels (see #256).
* Don't use `ForkJoinPool` if there is a `SecurityManager` present to work around JNLP problems (see #216, PR by @NikolayMetchev).
* JS: Check for undefined `window.addEventListener` when choosing default coroutine dispatcher (see #230, PR by @ScottPierce).
* Update 3rd party dependencies:
* [kotlinx-coroutines-rx1](reactive/kotlinx-coroutines-rx1) to RxJava version `1.3.6`.
* [kotlinx-coroutines-rx2](reactive/kotlinx-coroutines-rx2) to RxJava version `2.1.9`.
* [kotlinx-coroutines-guava](integration/kotlinx-coroutines-guava) to Guava version `24.0-jre`.
## Version 0.22.2
* Android: Use @Keep annotation on AndroidExceptionPreHandler to fix the problem on Android with minification enabled (see #214).
* Reactive: Added `awaitFirstOrDefault` and `awaitFirstOrNull` extensions (see #224, PR by @konrad-kaminski).
* Core: Fixed `withTimeout` and `withTimeoutOrNull` that should not use equals on result (see #212, PR by @konrad-kaminski).
* Core: Fixed hanged receive from a closed subscription of BroadcastChannel (see #226).
* IO: fixed error propagation (see https://github.com/ktorio/ktor/issues/301).
* Include common sources into sources jar file to work around KT-20971.
* Fixed bugs in documentation due to MPP.
## Version 0.22.1
* Migrated to Kotlin 1.2.21.
* Improved `actor` builder documentation (see #210) and fixed bugs in rendered documentation due to multiplatform.
* Fixed `runBlocking` to properly support specified dispatchers (see #209).
* Fixed data race in `Job` implementation (it was hanging at `LockFreeLinkedList.helpDelete` on certain stress tests).
* `AbstractCoroutine.onCancellation` is invoked before cancellation handler that is set via `invokeOnCompletion`.
* Ensure that `launch` handles uncaught exception before another coroutine that uses `join` on it resumes (see #208).
## Version 0.22
* Migrated to Kotlin 1.2.20.
* Introduced stable public API for `AbstractCoroutine`:
* Implements `Job`, `Continuation`, and `CoroutineScope`.
* Has overridable `onStart`, `onCancellation`, `onCompleted` and `onCompletedExceptionally` functions.
* Reactive integration modules are now implemented using public API only.
* Notifies onXXX before all the installed handlers, so `launch` handles uncaught exceptions before "joining" coroutines wakeup (see #208).
## Version 0.21.2
* Fixed `openSubscription` extension for reactive `Publisher`/`Observable`/`Flowable` when used with `select { ... }` and added an optional `request` parameter to specify how many elements are requested from publisher in advance on subscription (see #197).
* Simplified implementation of `Channel.flatMap` using `toChannel` function to work around Android 5.0 APK install SIGSEGV (see #205).
## Version 0.21.1
* Improved performance of coroutine dispatching (`DispatchTask` instance is no longer allocated).
* Fixed `Job.cancel` and `CompletableDeferred.complete` to support cancelling/completing states and properly wait for their children to complete on join/await (see #199).
* Fixed a bug in binary heap implementation (used internally by `delay`) which could have resulted in wrong delay time in rare circumstances.
* Coroutines library for [Kotlin/JS](js/README.md):
* `Promise.asDeferred` immediately installs handlers to avoid "Unhandled promise rejection" warning.
* Use `window.postMessage` instead of `setTimeout` for coroutines inside the browser to avoid timeout throttling (see #194).
* Use custom queue in `Window.awaitAnimationFrame` to align all animations and reduce overhead.
* Introduced `Window.asCoroutineDispatcher()` extension function.
## Version 0.21
* Migrated to Kotlin 1.2.10.
* Coroutines library for [Kotlin/JS](js/README.md) and [multiplatform projects](https://kotlinlang.org/docs/reference/multiplatform.html) (see #33):
* `launch` and `async` coroutine builders.
* `Job` and `Deferred` light-weight future with cancellation support.
* `delay` and `yield` top-level suspending functions.
* `await` extension for JS `Promise` and `asPromise`/`asDeferred` conversions.
* `promise` coroutine builder.
* `Job()` and `CompletableDeferred()` factories.
* Full support for parent-child coroutine hierarchies.
* `Window.awaitAnimationFrame` extension function.
* [Sample frontend Kotlin/JS application](js/example-frontend-js/README.md) with coroutine-driven animations.
* `run` is deprecated and renamed to `withContext` (see #134).
* `runBlocking` and `EventLoop` implementations optimized (see #190).
## Version 0.20
* Migrated to Kotlin 1.2.0.
* Channels:
* Sequence-like `filter`, `map`, etc extensions on `ReceiveChannel` are introduced (see #88 by @fvasco and #69 by @konrad-kaminski).
* Introduced `ReceiveChannel.cancel` method.
* All operators on `ReceiveChannel` fully consume the original channel (`cancel` it when they are done) using a helper `consume` extension.
* Deprecated `ActorJob` and `ProducerJob`; `actor` now returns `SendChannel` and `produce` returns `ReceiveChannel` (see #127).
* `SendChannel.sendBlocking` extension method (see #157 by @@fvasco).
* Parent-child relations between coroutines:
* Introduced an optional `parent` job parameter for all coroutine builders so that code with an explict parent `Job` is more natural.
* Added `parent` parameter to `CompletableDeferred` constructor.
* Introduced `Job.children` property.
* `Job.cancelChildren` is now an extension (member is deprecated and hidden).
* `Job.joinChildren` extension is introduced.
* Deprecated `Job.attachChild` as a error-prone API.
* Fixed StackOverflow when waiting for a lot of completed children that did not remove their handlers from the parent.
* Use `java.util.ServiceLoader` to find default instances of `CoroutineExceptionHandler`.
* Android UI integration:
* Use `Thread.getUncaughtExceptionPreHandler` to make sure that exceptions are logged before crash (see #148).
* Introduce `UI.awaitFrame` for animation; added sample coroutine-based animation application for Android [here](ui/kotlinx-coroutines-android/animation-app).
* Fixed `delay(Long.MAX_VALUE)` (see #161)
* Added missing `DefaultDispatcher` on some reactive operators (see #174 by @fvasco)
* Fixed `actor` and `produce` so that a cancellation of a Job cancels the underlying channel (closes and removes all the pending messages).
* Fixed sporadic failure of `example-context-06` (see #160)
* Fixed hang of `Job.start` on lazy coroutine with attached `invokeOnCompletion` handler.
* A more gradual introduction to `runBlocking` and coroutines in the [guide](docs/topics/coroutines-guide.md) (see #166).
## Version 0.19.3
* Fixed `send`/`openSubscription` race in `ArrayBroadcastChannel`.
This race lead to stalled (hanged) `send`/`receive` invocations.
* Project build has been migrated to Gradle.
## Version 0.19.2
* Fixed `ArrayBroadcastChannel` receive of stale elements on `openSubscription`.
Only elements that are sent after invocation of `openSubscription` are received now.
* Added a default value for `context` parameter to `rxFlowable` (see #146 by @PhilGlass).
* Exception propagation logic from cancelled coroutines is adjusted (see #152):
* When cancelled coroutine crashes due to some other exception, this other exception becomes the cancellation reason
of the coroutine, while the original cancellation reason is suppressed.
* `UnexpectedCoroutineException` is no longer used to report those cases as is removed.
* This fixes a race between crash of CPU-consuming coroutine and cancellation which resulted in an unhandled exception
and lead to crashes on Android.
* `run` uses cancelling state & propagates exceptions when cancelled (see #147):
* When coroutine that was switched into a different dispatcher using `run` is cancelled, the run invocation does not
complete immediately, but waits until the body completes.
* If the body completes with exception, then this exception is propagated.
* No `Job` in `newSingleThreadContext` and `newFixedThreadPoolContext` anymore (see #149, #151):
* This resolves the common issue of using `run(ctx)` where ctx comes from either `newSingleThreadContext` or
`newFixedThreadPoolContext` invocation. They both used to return a combination of dispatcher + job,
and this job was overriding the parent job, thus preventing propagation of cancellation. Not anymore.
* `ThreadPoolDispatcher` class is now public and is the result type for both functions.
It has the `close` method to release the thread pool.
## Version 0.19.1
* Failed parent Job cancels all children jobs, then waits for them them.
This makes parent-child hierarchies easier to get working right without
having to use `try/catch` or other exception handlers.
* Fixed a race in `ArrayBroadcastChannel` between `send` and `openChannel` invocations
(see #138).
* Fixed quite a rare race in `runBlocking` that resulted in `AssertionError`.
Unfortunately, cannot write a reliable stress-test to reproduce it.
* Updated Reactor support to leverage Bismuth release train
(contributed by @sdeleuze, see PR #141)
## Version 0.19
* This release is published to Maven Central.
* `DefaultDispatcher` is introduced (see #136):
* `launch`, `async`, `produce`, `actor` and other integration-specific coroutine builders now use
`DefaultDispatcher` as the default value for their `context` parameter.
* When a context is explicitly specified, `newCoroutineContext` function checks if there is any
interceptor/dispatcher defined in the context and uses `DefaultDispatcher` if there is none.
* `DefaultDispatcher` is currently defined to be equal to `CommonPool`.
* Examples in the [guide](docs/topics/coroutines-guide.md) now start with `launch { ... }` code and explanation on the nature
and the need for coroutine context starts in "Coroutine context and dispatchers" section.
* Parent coroutines now wait for their children (see #125):
* Job _completing_ state is introduced in documentation as a state in which parent coroutine waits for its children.
* `Job.attachChild` and `Job.cancelChildren` are introduced.
* `Job.join` now always checks cancellation status of invoker coroutine for predictable behavior when joining
failed child coroutine.
* `Job.cancelAndJoin` extension is introduced.
* `CoroutineContext.cancel` and `CoroutineContext.cancelChildren` extensions are introduced for convenience.
* `withTimeout`/`withTimeoutOrNull` blocks become proper coroutines that have `CoroutineScope` and wait for children, too.
* Diagnostics in cancellation and unexpected exception messages are improved,
coroutine name is included in debug mode.
* Fixed cancellable suspending functions to throw `CancellationException` (as was documented before) even when
the coroutine is cancelled with another application-specific exception.
* `JobCancellationException` is introduced as a specific subclass of `CancellationException` which is
used for coroutines that are cancelled without cause and to wrap application-specific exceptions.
* `Job.getCompletionException` is renamed to `Job.getCancellationException` and return a wrapper exception if needed.
* Introduced `Deferred.getCompletionExceptionOrNull` to get not-wrapped exception result of `async` task.
* Updated docs for `Job` & `Deferred` to explain parent/child relations.
* `select` expression is modularized:
* `SelectClause(0,1,2)` interfaces are introduced, so that synchronization
constructs can define their select clauses without having to modify
the source of the `SelectBuilder` in `kotlinx-corounes-core` module.
* `Job.onJoin`, `Deferred.onAwait`, `Mutex.onLock`, `SendChannel.onSend`, `ReceiveChannel.onReceive`, etc
that were functions before are now properties returning the corresponding select clauses. Old functions
are left in bytecode for backwards compatibility on use-site, but any outside code that was implementing those
interfaces by itself must be updated.
* This opens road to moving channels into a separate module in future updates.
* Renamed `TimeoutException` to `TimeoutCancellationException` (old name is deprecated).
* Fixed various minor problems:
* JavaFx toolkit is now initialized by `JavaFx` context (see #108).
* Fixed lost ACC_STATIC on <clinit> methods (see #116).
* Fixed link to source code from documentation (see #129).
* Fixed `delay` in arbitrary contexts (see #133).
* `kotlinx-coroutines-io` module is introduced. It is a work-in-progress on `ByteReadChannel` and `ByteWriteChannel`
interfaces, their implementations, and related classes to enable convenient coroutine integration with various
asynchronous I/O libraries and sockets. It is currently _unstable_ and **will change** in the next release.
## Version 0.18
* Kotlin 1.1.4 is required to use this version, which enables:
* `withLock` and `consumeEach` functions are now inline suspend functions.
* `JobSupport` class implementation is optimized (one fewer field).
* `TimeoutException` is public (see #89).
* Improvements to `Mutex` (courtesy of @fvasco):
* Introduced `holdsLock` (see #92).
* Improved documentation on `Mutex` fairness (see #90).
* Fixed NPE when `ArrayBroadcastChannel` is closed concurrently with receive (see #97).
* Fixed bug in internal class LockFreeLinkedList that resulted in ISE under stress in extremely rare circumstances.
* Integrations:
* [quasar](integration/kotlinx-coroutines-quasar): Introduced integration with suspendable JVM functions
that are instrumented with [Parallel Universe Quasar](https://docs.paralleluniverse.co/quasar/)
(thanks to the help of @pron).
* [reactor](reactive/kotlinx-coroutines-reactor): Replaced deprecated `setCancellation` with `onDipose` and
updated to Aluminium-SR3 release (courtesy of @yxf07, see #96)
* [jdk8](integration/kotlinx-coroutines-jdk8): Added adapters for `java.time` classes (courtesy of @fvasco, see #93)
## Version 0.17
* `CompletableDeferred` is introduced as a set-once event-like communication primitive (see #70).
* [Coroutines guide](docs/topics/coroutines-guide.md) uses it in a section on actors.
* `CompletableDeferred` is an interface with private impl (courtesy of @fvasco, see #86).
* It extends `Deferred` interface with `complete` and `completeExceptionally` functions.
* `Job.join` and `Deferred.await` wait until a cancelled coroutine stops execution (see #64).
* `Job` and `Deferred` have a new _cancelling_ state which they enter on invocation of `cancel`.
* `Job.invokeOnCompletion` has an additional overload with `onCancelling: Boolean` parameter to
install handlers that are fired as soon as coroutine enters _cancelling_ state as opposed
to waiting until it _completes_.
* Internal `select` implementation is refactored to decouple it from `JobSupport` internal class
and to optimize its state-machine.
* Internal `AbstractCoroutine` class is refactored so that it is extended only by true coroutines,
all of which support the new _cancelling_ state.
* `CoroutineScope.context` is renamed to `coroutineContext` to avoid conflicts with other usages of `context`
in applications (like Android context, see #75).
* `BroadcastChannel.open` is renamed to `openSubscription` (see #54).
* Fixed `StackOverflowError` in a convoy of `Mutex.unlock` invokers with `Unconfined` dispatcher (see #80).
* Fixed `SecurityException` when trying to use coroutines library with installed `SecurityManager`.
* Fixed a bug in `withTimeoutOrNull` in case with nested timeouts when coroutine was cancelled before it was
ever suspended.
* Fixed a minor problem with `awaitFirst` on reactive streams that would have resulted in spurious stack-traces printed
on the console when used with publishers/observables that continue to invoke `onNext` despite being cancelled/disposed
(which they are technically allowed to do by specification).
* All factory functions for various interfaces are implemented as top-level functions
(affects `Job`, `Channel`, `BroadcastChannel`, `Mutex`, `EventLoop`, and `CoroutineExceptionHandler`).
Previous approach of using `operator invoke` on their companion objects is deprecated.
* Nicer-to-use debug `toString` implementations for coroutine dispatcher tasks and continuations.
* A default dispatcher for `delay` is rewritten and now shares code with `EventLoopImpl` that is used by
`runBlocking`. It internally supports non-default `TimeSource` so that delay-using tests can be written
with "virtual time" by replacing their time source for the duration of tests (this feature is not available
outside of the library).
## Version 0.16
* Coroutines that are scheduled for execution are cancellable by default now
* `suspendAtomicCancellableCoroutine` function is introduced for funs like
`send`/`receive`/`receiveOrNull` that require atomic cancellation
(they cannot be cancelled after decision was made)
* Coroutines started with default mode using
`async`/`launch`/`actor` builders can be cancelled before their execution starts
* `CoroutineStart.ATOMIC` is introduced as a start mode to specify that
coroutine cannot be cancelled before its execution starts
* `run` function is also cancellable in the same way and accepts an optional
`CoroutineStart` parameter to change this default.
* `BroadcastChannel` factory function is introduced
* `CoroutineExceptionHandler` factory function is introduced by @konrad-kaminski
* [`integration`](integration) directory is introduced for all 3rd party integration projects
* It has [contribution guidelines](integration/README.md#contributing) and contributions from community are welcome
* Support for Guava `ListenableFuture` in the new [`kotlinx-coroutines-guava`](integration/kotlinx-coroutines-guava) module
* Rx1 Scheduler support by @konrad-kaminski
* Fixed a number of `Channel` and `BroadcastChannel` implementation bugs related to concurrent
send/close/close of channels that lead to hanging send, offer or close operations (see #66).
Thanks to @chrisly42 and @cy6erGn0m for finding them.
* Fixed `withTimeoutOrNull` which was returning `null` on timeout of inner or outer `withTimeout` blocks (see #67).
Thanks to @gregschlom for finding the problem.
* Fixed a bug where `Job` fails to dispose a handler when it is the only handler by @uchuhimo
## Version 0.15
* Switched to Kotlin version 1.1.2 (can still be used with 1.1.0).
* `CoroutineStart` enum is introduced for `launch`/`async`/`actor` builders:
* The usage of `luanch(context, start = false)` is deprecated and is replaced with
`launch(context, CoroutineStart.LAZY)`
* `CoroutineStart.UNDISPATCHED` is introduced to start coroutine execution immediately in the invoker thread,
so that `async(context, CoroutineStart.UNDISPATCHED)` is similar to the behavior of C# `async`.
* [Guide to UI programming with coroutines](ui/coroutines-guide-ui.md) mentions the use of it to optimize
the start of coroutines from UI threads.
* Introduced `BroadcastChannel` interface in `kotlinx-coroutines-core` module:
* It extends `SendChannel` interface and provides `open` function to create subscriptions.
* Subscriptions are represented with `SubscriptionReceiveChannel` interface.
* The corresponding `SubscriptionReceiveChannel` interfaces are removed from [reactive](reactive) implementation
modules. They use an interface defined in `kotlinx-coroutines-core` module.
* `ConflatedBroadcastChannel` implementation is provided for state-observation-like use-cases, where a coroutine or a
regular code (in UI, for example) updates the state that subscriber coroutines shall react to.
* `ArrayBroadcastChannel` implementation is provided for event-bus-like use-cases, where a sequence of events shall
be received by multiple subscribers without any omissions.
* [Guide to reactive streams with coroutines](reactive/coroutines-guide-reactive.md) includes
"Rx Subject vs BroadcastChannel" section.
* Pull requests from Konrad Kamiński are merged into reactive stream implementations:
* Support for Project Reactor `Mono` and `Flux`.
See [`kotlinx-coroutines-reactor`](reactive/kotlinx-coroutines-reactor) module.
* Implemented Rx1 `Completable.awaitCompleted`.
* Added support for Rx2 `Maybe`.
* Better timeout support:
* Introduced `withTimeoutOrNull` function.
* Implemented `onTimeout` clause for `select` expressions.
* Fixed spurious concurrency inside `withTimeout` blocks on their cancellation.
* Changed behavior of `withTimeout` when `CancellationException` is suppressed inside the block.
Invocation of `withTimeout` now always returns the result of execution of its inner block.
* The `channel` property in `ActorScope` is promoted to a wider `Channel` type, so that an actor
can have an easy access to its own inbox send channel.
* Renamed `Mutex.withMutex` to `Mutex.withLock`, old name is deprecated.
## Version 0.14
* Switched to Kotlin version 1.1.1 (can still be used with 1.1.0).
* Introduced `consumeEach` helper function for channels and reactive streams, Rx 1.x, and Rx 2.x.
* It ensures that streams are unsubscribed from on any exception.
* Iteration with `for` loop on reactive streams is **deprecated**.
* [Guide to reactive streams with coroutines](reactive/coroutines-guide-reactive.md) is updated virtually
all over the place to reflect these important changes.
* Implemented `awaitFirstOrDefault` extension for reactive streams, Rx 1.x, and Rx 2.x.
* Added `Mutex.withMutex` helper function.
* `kotlinx-coroutines-android` module has `provided` dependency on of Android APIs to
eliminate warnings when using it in android project.
## Version 0.13
* New `kotlinx-coroutinex-android` module with Android `UI` context implementation.
* Introduced `whileSelect` convenience function.
* Implemented `ConflatedChannel`.
* Renamed various `toXXX` conversion functions to `asXXX` (old names are deprecated).
* `run` is optimized with fast-path case and no longer has `CoroutineScope` in its block.
* Fixed dispatching logic of `withTimeout` (removed extra dispatch).
* `EventLoop` that is used by `runBlocking` now implements Delay, giving more predictable test behavior.
* Various refactorings related to resource management and timeouts:
* `Job.Registration` is renamed to `DisposableHandle`.
* `EmptyRegistration` is renamed to `NonDisposableHandle`.
* `Job.unregisterOnCompletion` is renamed to `Job.disposeOnCompletion`.
* `Delay.invokeOnTimeout` is introduced.
* `withTimeout` now uses `Delay.invokeOnTimeout` when available.
* A number of improvement for reactive streams and Rx:
* Introduced `rxFlowable` builder for Rx 2.x.
* `Scheduler.asCoroutineDispatcher` extension for Rx 2.x.
* Fixed bug with sometimes missing `onComplete` in `publish`, `rxObservable`, and `rxFlowable` builders.
* Channels that are open for reactive streams are now `Closeable`.
* Fixed `CompletableSource.await` and added test for it.
* Removed `rx.Completable.await` due to name conflict.
* New documentation:
* [Guide to UI programming with coroutines](ui/coroutines-guide-ui.md)
* [Guide to reactive streams with coroutines](reactive/coroutines-guide-reactive.md)
* Code is published to JCenter repository.
## Version 0.12
* Switched to Kotlin version 1.1.0 release.
* Reworked and updated utilities for
[Reactive Streams](kotlinx-coroutines-reactive),
[Rx 1.x](kotlinx-coroutines-rx1), and
[Rx 2.x](kotlinx-coroutines-rx2) with library-specific
coroutine builders, suspending functions, converters and iteration support.
* `LinkedListChannel` with unlimited buffer (`offer` always succeeds).
* `onLock` select clause and an optional `owner` parameter in all `Mutex` functions.
* `selectUnbiased` function.
* `actor` coroutine builder.
* Couple more examples for "Shared mutable state and concurrency" section and
"Channels are fair" section with ping-pong table example
in [coroutines guide](docs/topics/coroutines-guide.md).
## Version 0.11-rc
* `select` expression with onJoin/onAwait/onSend/onReceive clauses.
* `Mutex` is moved to `kotlinx.coroutines.sync` package.
* `ClosedSendChannelException` is a subclass of `CancellationException` now.
* New sections on "Shared mutable state and concurrency" and "Select expression"
in [coroutines guide](docs/topics/coroutines-guide.md).
## Version 0.10-rc
* Switched to Kotlin version 1.1.0-rc-91.
* `Mutex` synchronization primitive is introduced.
* `buildChannel` is renamed to `produce`, old name is deprecated.
* `Job.onCompletion` is renamed to `Job.invokeOnCompletion`, old name is deprecated.
* `delay` implementation in Swing, JavaFx, and scheduled executors is fixed to avoid an extra dispatch.
* `CancellableContinuation.resumeUndispatched` is introduced to make this efficient implementation possible.
* Remove unnecessary creation of `CancellationException` to improve performance, plus other performance improvements.
* Suppress deprecated and internal APIs from docs.
* Better docs at top level with categorized summary of classes and functions.
## Version 0.8-beta
* `defer` coroutine builder is renamed to `async`.
* `lazyDefer` is deprecated, `async` has an optional `start` parameter instead.
* `LazyDeferred` interface is deprecated, lazy start functionality is integrated into `Job` interface.
* `launch` has an optional `start` parameter for lazily started coroutines.
* `Job.start` and `Job.isCompleted` are introduced.
* `Deferred.isCompletedExceptionally` and `Deferred.isCancelled` are introduced.
* `Job.getInactiveCancellationException` is renamed to `getCompletionException`.
* `Job.join` is now a member function.
* Internal `JobSupport` state machine is enhanced to support _new_ (not-started-yet) state.
So, lazy coroutines do not need a separate state variable to track their started/not-started (new/active) status.
* Exception transparency in `Job.cancel` (original cause is rethrown).
* Clarified possible states for `Job`/`CancellableContinuation`/`Deferred` in docs.
* Example on async-style functions and links to API reference site from [coroutines guide](docs/topics/coroutines-guide.md).
## Version 0.7-beta
* Buffered and unbuffered channels are introduced: `Channel`, `SendChannel`, and `ReceiveChannel` interfaces,
`RendezvousChannel` and `ArrayChannel` implementations, `Channel()` factory function and `buildChannel{}`
coroutines builder.
* `Here` context is renamed to `Unconfined` (the old name is deprecated).
* A [guide on coroutines](docs/topics/coroutines-guide.md) is expanded: sections on contexts and channels.
## Version 0.6-beta
* Switched to Kotlin version 1.1.0-beta-37.
* A [guide on coroutines](docs/topics/coroutines-guide.md) is expanded.
## Version 0.5-beta
* Switched to Kotlin version 1.1.0-beta-22 (republished version).
* Removed `currentCoroutineContext` and related thread-locals without replacement.
Explicitly pass coroutine context around if needed.
* `lazyDefer(context) {...}` coroutine builder and `LazyDeferred` interface are introduced.
* The default behaviour of all coroutine dispatchers is changed to always schedule execution of new coroutine
for later in this thread or thread pool. Correspondingly, `CoroutineDispatcher.isDispatchNeeded` function
has a default implementation that returns `true`.
* `NonCancellable` context is introduced.
* Performance optimizations for cancellable continuations (fewer objects created).
* A [guide on coroutines](docs/topics/coroutines-guide.md) is added.
## Version 0.4-beta
* Switched to Kotlin version 1.1.0-beta-18 (republished version).
* `CoroutineDispatcher` methods now have `context` parameter.
* Introduced `CancellableContinuation.isCancelled`
* Introduced `EventLoop` dispatcher and made it a default for `runBlocking { ... }`
* Introduced `CoroutineScope` interface with `isActive` and `context` properties;
standard coroutine builders include it as receiver for convenience.
* Introduced `Executor.toCoroutineDispatcher()` extension.
* Delay scheduler thread is not daemon anymore, but times out automatically.
* Debugging facilities in `newCoroutineContext` can be explicitly disabled with `-Dkotlinx.coroutines.debug=off`.
* xxx-test files are renamed to xxx-example for clarity.
* Fixed NPE in Job implementation when starting coroutine with already cancelled parent job.
* Support cancellation in `kotlinx-coroutines-nio` module
================================================
FILE: CODE_OF_CONDUCT.md
================================================
## Code of Conduct
This project and the corresponding community is governed by the [JetBrains Open Source and Community Code of Conduct](https://confluence.jetbrains.com/display/ALL/JetBrains+Open+Source+and+Community+Code+of+Conduct). Please make sure you read it.
================================================
FILE: CONTRIBUTING.md
================================================
# Contributing Guidelines
There are two main ways to contribute to the project — submitting issues and submitting
fixes/changes/improvements via pull requests.
## Submitting issues
Both bug reports and feature requests are welcome.
Submit issues [here](https://github.com/Kotlin/kotlinx.coroutines/issues).
Questions about usage and general inquiries are better suited for [StackOverflow](https://stackoverflow.com)
or the `#coroutines` channel in [KotlinLang Slack](https://surveys.jetbrains.com/s3/kotlin-slack-sign-up).
There, questions get answered much quicker than they do in this issue tracker,
while also reducing the load on the maintainers.
### Commenting on issues
Describing why you're interested in some specific issue helps us a lot with looking for the best solution.
The more experiences, concerns, or suggestions get shared, the better!
If you feel that something you know hasn't been said (or even if the issue discussion is too long to actually
make sure of it), please do not hesitate to drop a line.
If you feel like your case was already described and you have nothing to add, please still let us know about
your interest by leaving a smiley (👍)! We use these as indicators of demand.
Plese not that there is no need to leave a comment in this case, though.
"+1"-style remarks or questions about the progress on an issue do not bring anything new
and only create noise, complicating the job of finding insight in the discussion.
Please avoid this. We reserve the right to delete such comments.
## Submitting PRs
We love PRs. Submit PRs [here](https://github.com/Kotlin/kotlinx.coroutines/pulls).
However, please keep in mind that maintainers will have to support the resulting code of the project,
so do familiarize yourself with the following guidelines.
* All development (both new features and bug fixes) is performed in the `develop` branch.
* The `master` branch contains the sources of the most recently released version.
* Base your PRs against the `develop` branch.
* The `develop` branch is pushed to the `master` branch during release.
* Documentation in markdown files can be updated directly in the `master` branch,
unless the documentation is in the source code, and the patch changes line numbers.
* If you fix documentation:
* After fixing/changing code examples in the [`docs`](docs) folder or updating any references in the markdown files
run the [Knit tool](#running-the-knit-tool) and commit the resulting changes as well.
The tests will not pass otherwise.
* If you plan extensive rewrites/additions to the docs, then please [contact the maintainers](#contacting-maintainers)
to coordinate the work in advance.
* If you make any code changes:
* Follow the [Kotlin Coding Conventions](https://kotlinlang.org/docs/reference/coding-conventions.html).
Use 4 spaces for indentation.
Do not add extra newlines in function bodies: if you feel that blocks of code should be logically separated,
then separate them with a comment instead.
* [Build the project](#building) to make sure everything works and passes the tests.
* If you fix a bug:
* Note that what is a bug for some can be a feature for others.
Are you truly fixing a problem? Is there an open issue about it?
* Write the test that reproduces the bug.
* Fixes without tests are accepted only in exceptional circumstances if it can be shown that writing the
corresponding test is too hard or otherwise impractical.
* Follow the style of writing tests that is used in this project:
name test functions as `testXxx`. Don't use backticks in test names.
* If you introduce any new public APIs:
* Before setting out to work on a problem, comment on the existing issue or create one,
proposing a solution and gathering feedback first before implementing it.
PRs that add new API without the corresponding issue with positive feedback about the proposed implementation are
very unlikely to be approved or reviewed.
* All new APIs must come with documentation and tests.
* All new APIs are initially released with the `@ExperimentalCoroutineApi` annotation and graduate later.
* [Update the public API dumps](#updating-the-public-api-dump) and commit the resulting changes as well.
It will not pass the tests otherwise.
## Building
This library is built with Gradle.
* Run `./gradlew build` to build, also running all of the tests.
* Run `./gradlew <module>:check` to test the module you are working with to speed
things up during development.
* Run `./gradlew <module>:jvmTest` to perform only the fast JVM tests of a multiplatform module.
* Run `./gradlew <module>:jvmTest -Pstress=true` to run both fast and slow JVM tests.
### Environment requirements
JDK >= 11 referred to by the `JAVA_HOME` environment variable.
### Running the Knit tool
* Use [Knit](https://github.com/Kotlin/kotlinx-knit/blob/main/README.md) for updates to documentation:
* Run `./gradlew knit` to update the example files, links, tables of content.
* Commit the updated documents and examples together with other changes.
### Updating the public API dump
* Use the [Binary Compatibility Validator](https://github.com/Kotlin/binary-compatibility-validator/blob/master/README.md) for updates to public API:
* Run `./gradlew apiDump` to update API index files.
* Commit the updated API indexes together with other changes.
## Releases
* The full release procedure checklist is [here](RELEASE.md).
## Contacting maintainers
* If something cannot be done, not convenient, or does not work — submit an [issue](#submitting-issues).
* "How to do something" questions — [StackOverflow](https://stackoverflow.com).
* Discussions and general inquiries — use `#coroutines` channel in [KotlinLang Slack](https://kotl.in/slack).
================================================
FILE: LICENSE.txt
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2000-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: README.md
================================================
# kotlinx.coroutines
[](https://kotlinlang.org/docs/components-stability.html)
[](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
[](https://www.apache.org/licenses/LICENSE-2.0)
[](https://central.sonatype.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.10.2)
[](http://kotlinlang.org)
[](https://kotlinlang.org/api/kotlinx.coroutines/)
[](https://kotlinlang.slack.com/messages/coroutines/)
Library support for Kotlin coroutines with [multiplatform](#multiplatform) support.
This is a companion version for the Kotlin `2.1.0` release.
```kotlin
suspend fun main() = coroutineScope {
launch {
delay(1000)
println("Kotlin Coroutines World!")
}
println("Hello")
}
```
> Play with coroutines online [here](https://pl.kotl.in/lPYtYEtD5)
## Modules
* [core](kotlinx-coroutines-core/README.md) — common coroutines across all platforms:
* [launch] and [async] coroutine builders returning [Job] and [Deferred] light-weight futures with cancellation support;
* [Dispatchers] object with [Main][Dispatchers.Main] dispatcher for Android/Swing/JavaFx (which require the corresponding artifacts in runtime) and Darwin (included out of the box), and [Default][Dispatchers.Default] dispatcher for background coroutines;
* [delay] and [yield] top-level suspending functions;
* [Flow] — cold asynchronous stream with [flow][_flow] builder and comprehensive operator set ([filter], [map], etc);
* [Channel], [Mutex], and [Semaphore] communication and synchronization primitives;
* [coroutineScope][_coroutineScope], [supervisorScope][_supervisorScope], [withContext], and [withTimeout] scope builders;
* [MainScope()] for Android and UI applications;
* [SupervisorJob()] and [CoroutineExceptionHandler] for supervision of coroutines hierarchies;
* [select] expression support and more.
* [core/jvm](kotlinx-coroutines-core/jvm/) — additional core features available on Kotlin/JVM:
* [Dispatchers.IO] dispatcher for blocking coroutines;
* [Executor.asCoroutineDispatcher][asCoroutineDispatcher] extension, custom thread pools, and more;
* Integrations with `CompletableFuture` and JVM-specific extensions.
* [core/js](kotlinx-coroutines-core/js/) — additional core features available on Kotlin/JS:
* Integration with `Promise` via [Promise.await] and [promise] builder;
* Integration with `Window` via [Window.asCoroutineDispatcher], etc.
* [test](kotlinx-coroutines-test/README.md) — test utilities for coroutines:
* [Dispatchers.setMain] to override [Dispatchers.Main] in tests;
* [runTest] and [TestScope] to test suspending functions and coroutines.
* [debug](kotlinx-coroutines-debug/README.md) — debug utilities for coroutines:
* [DebugProbes] API to probe, keep track of, print and dump active coroutines;
* [CoroutinesTimeout] test rule to automatically dump coroutines on test timeout.
* Automatic integration with [BlockHound](https://github.com/reactor/BlockHound).
* [reactive](reactive/README.md) — modules that provide builders and iteration support for various reactive streams libraries:
* Reactive Streams ([Publisher.collect], [Publisher.awaitSingle], [kotlinx.coroutines.reactive.publish], etc),
* Flow (JDK 9) (the same interface as for Reactive Streams),
* RxJava 2.x ([rxFlowable], [rxSingle], etc), and
* RxJava 3.x ([rxFlowable], [rxSingle], etc), and
* Project Reactor ([flux], [mono], etc).
* [ui](ui/README.md) — modules that provide the [Main][Dispatchers.Main] dispatcher for various single-threaded UI libraries:
* Android, JavaFX, and Swing.
* [integration](integration/README.md) — modules that provide integration with various asynchronous callback- and future-based libraries:
* Guava [ListenableFuture.await], and Google Play Services [Task.await];
* SLF4J MDC integration via [MDCContext].
## Documentation
* Presentations and videos:
* [Kotlin Coroutines in Practice](https://www.youtube.com/watch?v=a3agLJQ6vt8) (Roman Elizarov at KotlinConf 2018, [slides](https://www.slideshare.net/elizarov/kotlin-coroutines-in-practice-kotlinconf-2018))
* [Deep Dive into Coroutines](https://www.youtube.com/watch?v=YrrUCSi72E8) (Roman Elizarov at KotlinConf 2017, [slides](https://www.slideshare.net/elizarov/deep-dive-into-coroutines-on-jvm-kotlinconf-2017))
* [History of Structured Concurrency in Coroutines](https://www.youtube.com/watch?v=Mj5P47F6nJg) (Roman Elizarov at Hydra 2019, [slides](https://speakerdeck.com/elizarov/structured-concurrency))
* Guides and manuals:
* [Guide to kotlinx.coroutines by example](https://kotlinlang.org/docs/coroutines-guide.html) (**read it first**)
* [Guide to UI programming with coroutines](ui/coroutines-guide-ui.md)
* [Debugging capabilities in kotlinx.coroutines](docs/topics/debugging.md)
* [Compatibility policy and experimental annotations](docs/topics/compatibility.md)
* [Change log for kotlinx.coroutines](CHANGES.md)
* [Coroutines design document (KEEP)](https://github.com/Kotlin/KEEP/blob/master/proposals/coroutines.md)
* [Full kotlinx.coroutines API reference](https://kotlinlang.org/api/kotlinx.coroutines/)
## Using in your projects
### Maven
Add dependencies (you can also add other modules that you need):
```xml
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-core</artifactId>
<version>1.10.2</version>
</dependency>
```
And make sure that you use the latest Kotlin version:
```xml
<properties>
<kotlin.version>2.1.0</kotlin.version>
</properties>
```
### Gradle
Add dependencies (you can also add other modules that you need):
```kotlin
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2")
}
```
And make sure that you use the latest Kotlin version:
```kotlin
plugins {
// For build.gradle.kts (Kotlin DSL)
kotlin("jvm") version "2.1.0"
// For build.gradle (Groovy DSL)
id "org.jetbrains.kotlin.jvm" version "2.1.0"
}
```
Make sure that you have `mavenCentral()` in the list of repositories:
```kotlin
repositories {
mavenCentral()
}
```
### Android
Add [`kotlinx-coroutines-android`](ui/kotlinx-coroutines-android)
module as a dependency when using `kotlinx.coroutines` on Android:
```kotlin
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2")
```
This gives you access to the Android [Dispatchers.Main]
coroutine dispatcher and also makes sure that in case of a crashed coroutine with an unhandled exception that
this exception is logged before crashing the Android application, similarly to the way uncaught exceptions in
threads are handled by the Android runtime.
#### R8 and ProGuard
R8 and ProGuard rules are bundled into the [`kotlinx-coroutines-android`](ui/kotlinx-coroutines-android) module.
For more details see ["Optimization" section for Android](ui/kotlinx-coroutines-android/README.md#optimization).
#### Avoiding including the debug infrastructure in the resulting APK
The `kotlinx-coroutines-core` artifact contains a resource file that is not required for the coroutines to operate
normally and is only used by the debugger. To exclude it at no loss of functionality, add the following snippet to the
`android` block in your Gradle file for the application subproject:
```kotlin
packagingOptions {
resources.excludes += "DebugProbesKt.bin"
}
```
### Multiplatform
Core modules of `kotlinx.coroutines` are also available for
[Kotlin/JS](https://kotlinlang.org/docs/reference/js-overview.html) and [Kotlin/Native](https://kotlinlang.org/docs/reference/native-overview.html).
In common code that should get compiled for different platforms, you can add a dependency to `kotlinx-coroutines-core` right to the `commonMain` source set:
```kotlin
commonMain {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2")
}
}
```
Platform-specific dependencies are recommended to be used only for non-multiplatform projects that are compiled only for target platform.
#### JS
Kotlin/JS version of `kotlinx.coroutines` is published as
[`kotlinx-coroutines-core-js`](https://central.sonatype.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.10.2)
(follow the link to get the dependency declaration snippet).
#### Native
Kotlin/Native version of `kotlinx.coroutines` is published as
[`kotlinx-coroutines-core-$platform`](https://central.sonatype.com/search?q=kotlinx-coroutines-core&namespace=org.jetbrains.kotlinx) where `$platform` is
the target Kotlin/Native platform.
Targets are provided in accordance with [official K/N target support](https://kotlinlang.org/docs/native-target-support.html).
## Building and Contributing
See [Contributing Guidelines](CONTRIBUTING.md).
<!--- MODULE kotlinx-coroutines-core -->
<!--- INDEX kotlinx.coroutines -->
[launch]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/launch.html
[async]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/async.html
[Job]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-job/index.html
[Deferred]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-deferred/index.html
[Dispatchers]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-dispatchers/index.html
[Dispatchers.Main]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-dispatchers/-main.html
[Dispatchers.Default]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-dispatchers/-default.html
[delay]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/delay.html
[yield]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/yield.html
[_coroutineScope]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/coroutine-scope.html
[_supervisorScope]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/supervisor-scope.html
[withContext]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/with-context.html
[withTimeout]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/with-timeout.html
[MainScope()]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-main-scope.html
[SupervisorJob()]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-supervisor-job.html
[CoroutineExceptionHandler]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-exception-handler/index.html
[Dispatchers.IO]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-i-o.html
[asCoroutineDispatcher]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/as-coroutine-dispatcher.html
[Promise.await]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/await.html
[promise]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/[js]promise.html
[Window.asCoroutineDispatcher]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/as-coroutine-dispatcher.html
<!--- INDEX kotlinx.coroutines.flow -->
[Flow]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html
[_flow]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/flow.html
[filter]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/filter.html
[map]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/map.html
<!--- INDEX kotlinx.coroutines.channels -->
[Channel]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/-channel/index.html
<!--- INDEX kotlinx.coroutines.selects -->
[select]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.selects/select.html
<!--- INDEX kotlinx.coroutines.sync -->
[Mutex]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.sync/-mutex/index.html
[Semaphore]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.sync/-semaphore/index.html
<!--- MODULE kotlinx-coroutines-test -->
<!--- INDEX kotlinx.coroutines.test -->
[Dispatchers.setMain]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-test/kotlinx.coroutines.test/set-main.html
[runTest]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-test/kotlinx.coroutines.test/run-test.html
[TestScope]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-test/kotlinx.coroutines.test/-test-scope/index.html
<!--- MODULE kotlinx-coroutines-debug -->
<!--- INDEX kotlinx.coroutines.debug -->
[DebugProbes]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-debug/kotlinx.coroutines.debug/-debug-probes/index.html
<!--- INDEX kotlinx.coroutines.debug.junit4 -->
[CoroutinesTimeout]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-debug/kotlinx.coroutines.debug.junit4/-coroutines-timeout/index.html
<!--- MODULE kotlinx-coroutines-slf4j -->
<!--- INDEX kotlinx.coroutines.slf4j -->
[MDCContext]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-slf4j/kotlinx.coroutines.slf4j/-m-d-c-context/index.html
<!--- MODULE kotlinx-coroutines-jdk8 -->
<!--- INDEX kotlinx.coroutines.future -->
<!--- MODULE kotlinx-coroutines-guava -->
<!--- INDEX kotlinx.coroutines.guava -->
[ListenableFuture.await]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-guava/kotlinx.coroutines.guava/await.html
<!--- MODULE kotlinx-coroutines-play-services -->
<!--- INDEX kotlinx.coroutines.tasks -->
[Task.await]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-play-services/kotlinx.coroutines.tasks/await.html
<!--- MODULE kotlinx-coroutines-reactive -->
<!--- INDEX kotlinx.coroutines.reactive -->
[Publisher.collect]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-reactive/kotlinx.coroutines.reactive/collect.html
[Publisher.awaitSingle]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-reactive/kotlinx.coroutines.reactive/await-single.html
[kotlinx.coroutines.reactive.publish]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-reactive/kotlinx.coroutines.reactive/publish.html
<!--- MODULE kotlinx-coroutines-rx2 -->
<!--- INDEX kotlinx.coroutines.rx2 -->
[rxFlowable]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-rx2/kotlinx.coroutines.rx2/rx-flowable.html
[rxSingle]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-rx2/kotlinx.coroutines.rx2/rx-single.html
<!--- MODULE kotlinx-coroutines-rx2 -->
<!--- INDEX kotlinx.coroutines.rx2 -->
<!--- MODULE kotlinx-coroutines-reactor -->
<!--- INDEX kotlinx.coroutines.reactor -->
[flux]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-reactor/kotlinx.coroutines.reactor/flux.html
[mono]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-reactor/kotlinx.coroutines.reactor/mono.html
<!--- END -->
================================================
FILE: RELEASE.md
================================================
# kotlinx.coroutines release checklist
To release a new `<version>` of `kotlinx-coroutines`:
1. Checkout the `develop` branch: <br>
`git checkout develop`
2. Retrieve the most recent `develop`: <br>
`git pull`
3. Make sure the `master` branch is fully merged into `develop`:
`git merge origin/master`
4. Search & replace `<old-version>` with `<version>` across the project files. Should replace in:
* Docs
* [`README.md`](README.md) (native, core, test, debug, modules)
* [`kotlinx-coroutines-debug/README.md`](kotlinx-coroutines-debug/README.md)
* [`kotlinx-coroutines-test/README.md`](kotlinx-coroutines-test/README.md)
* [`coroutines-guide-ui.md`](ui/coroutines-guide-ui.md)
* Properties
* [`gradle.properties`](gradle.properties)
* [`integration-testing/gradle.properties`](integration-testing/gradle.properties)
* Make sure to **exclude** `CHANGES.md` from replacements.
As an alternative approach, you can use `./bump-version.sh new_version`
5. Write release notes in [`CHANGES.md`](CHANGES.md):
* Use the old releases for style guidance.
* Write each change on a single line (don't wrap with CR).
* Look through the commit messages since the previous release.
6. Create the branch for this release:
`git checkout -b version-<version>`
7. Commit the updated files to the new version branch:<br>
`git commit -a -m "Version <version>"`
8. Push the new version to GitHub:<br>
`git push -u origin version-<version>`
9. Create a Pull-Request on GitHub from the `version-<version>` branch into `master`:
* Review it.
* Make sure it builds on CI.
* Get approval for it.
0. On [TeamCity integration server](https://teamcity.jetbrains.com/project.html?projectId=KotlinTools_KotlinxCoroutines):
* Wait until "Build" configuration for committed `version-<version>` branch passes tests.
* Run "Deploy (Configure, RUN THIS ONE)" configuration with the corresponding new version:
- Use the `version-<version>` branch
- Set the `DeployVersion` build parameter to `<version>`
* Wait until all four "Deploy" configurations finish.
1. In [Nexus](https://oss.sonatype.org/#stagingRepositories) admin interface:
* Close the repository and wait for it to verify.
* Release the repository.
2. Merge the new version branch into `master`:<br>
`git checkout master`<br>
`git merge version-<version>`<br>
`git push`
3. In [GitHub](https://github.com/kotlin/kotlinx.coroutines) interface:
* Create a release named `<version>`, creating the `<version>` tag.
* Cut & paste lines from [`CHANGES.md`](CHANGES.md) into description.
4. Announce the new release in [Slack](https://kotlinlang.slack.com)
5. Switch onto the `develop` branch:<br>
`git checkout develop`
6. Fetch the latest `master`:<br>
`git fetch`
7. Merge the release from `master`:<br>
`git merge origin/master`
8. Push the updates to GitHub:<br>
`git push`
9. Propose the website documentation update: <br>
* Set new value for [`KOTLINX_COROUTINES_RELEASE_TAG`](https://github.com/JetBrains/kotlin-web-site/blob/master/.teamcity/BuildParams.kt), creating a Pull Request in the website's repository.
================================================
FILE: benchmarks/build.gradle.kts
================================================
@file:Suppress("UnstableApiUsage")
import org.jetbrains.kotlin.gradle.tasks.*
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
id("me.champeau.jmh")
}
repositories {
maven("https://repo.typesafe.com/typesafe/releases/")
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.named<KotlinCompile>("compileJmhKotlin") {
compilerOptions {
jvmTarget = JvmTarget.JVM_1_8
freeCompilerArgs.add("-Xjvm-default=all")
}
}
val jmhJarTask = tasks.named<Jar>("jmhJar") {
archiveBaseName = "benchmarks"
archiveClassifier = null
archiveVersion = null
archiveVersion.convention(null as String?)
destinationDirectory = rootDir
}
tasks {
// For some reason the DuplicatesStrategy from jmh is not enough
// and errors with duplicates appear unless I force it to WARN only:
withType<Copy> {
duplicatesStrategy = DuplicatesStrategy.WARN
}
build {
dependsOn(jmhJarTask)
}
}
dependencies {
implementation("org.openjdk.jmh:jmh-core:1.35")
implementation("io.projectreactor:reactor-core:${version("reactor")}")
implementation("io.reactivex.rxjava2:rxjava:2.1.9")
implementation("com.github.akarnokd:rxjava2-extensions:0.20.8")
implementation("com.typesafe.akka:akka-actor_2.12:2.5.0")
implementation(project(":kotlinx-coroutines-core"))
implementation(project(":kotlinx-coroutines-debug"))
implementation(project(":kotlinx-coroutines-reactive"))
// add jmh dependency on main
"jmhImplementation"(sourceSets.main.get().runtimeClasspath)
}
================================================
FILE: benchmarks/scripts/generate_plots_flow_flatten_merge.py
================================================
# To run this script run the command 'python3 scripts/generate_plots_flow_flatten_merge.py' in the /benchmarks folder
import pandas as pd
import sys
import locale
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter
input_file = "build/reports/jmh/results.csv"
output_file = "out/flow-flatten-merge.svg"
# Please change the value of this variable according to the FlowFlattenMergeBenchmarkKt.ELEMENTS
elements = 100000
benchmark_name = "benchmarks.flow.FlowFlattenMergeBenchmark.flattenMerge"
csv_columns = ["Benchmark", "Score", "Unit", "Param: concurrency", "Param: flowsNumberStrategy"]
rename_columns = {"Benchmark": "benchmark", "Score" : "score", "Unit" : "unit",
"Param: concurrency" : "concurrency", "Param: flowsNumberStrategy" : "flows"}
markers = ['.', 'v', '^', '1', '2', '8', 'p', 'P', 'x', 'D', 'd', 's']
colours = ['red', 'gold', 'sienna', 'olivedrab', 'lightseagreen', 'navy', 'blue', 'm', 'crimson', 'yellow', 'orangered', 'slateblue', 'aqua', 'black', 'silver']
def next_colour():
i = 0
while True:
yield colours[i % len(colours)]
i += 1
def next_marker():
i = 0
while True:
yield markers[i % len(markers)]
i += 1
def draw(data, plt):
plt.xscale('log', basex=2)
plt.gca().xaxis.set_major_formatter(FormatStrFormatter('%0.f'))
plt.grid(linewidth='0.5', color='lightgray')
if data.unit.unique()[0] != "ops/s":
print("Unexpected time unit: " + data.unit.unique()[0])
sys.exit(1)
plt.ylabel("elements / ms")
plt.xlabel('concurrency')
plt.xticks(data.concurrency.unique())
colour_gen = next_colour()
marker_gen = next_marker()
for flows in data.flows.unique():
gen_colour = next(colour_gen)
gen_marker = next(marker_gen)
res = data[(data.flows == flows)]
# plt.plot(res.concurrency, res.score*elements/1000, label="flows={}".format(flows), color=gen_colour, marker=gen_marker)
plt.errorbar(x=res.concurrency, y=res.score*elements/1000, yerr=res.score_error*elements/1000, solid_capstyle='projecting',
label="flows={}".format(flows), capsize=4, color=gen_colour, linewidth=2.2)
langlocale = locale.getdefaultlocale()[0]
locale.setlocale(locale.LC_ALL, langlocale)
dp = locale.localeconv()['decimal_point']
if dp == ",":
csv_columns.append("Score Error (99,9%)")
rename_columns["Score Error (99,9%)"] = "score_error"
elif dp == ".":
csv_columns.append("Score Error (99.9%)")
rename_columns["Score Error (99.9%)"] = "score_error"
else:
print("Unexpected locale delimeter: " + dp)
sys.exit(1)
data = pd.read_csv(input_file, sep=",", decimal=dp)
data = data[csv_columns].rename(columns=rename_columns)
data = data[(data.benchmark == benchmark_name)]
plt.rcParams.update({'font.size': 15})
plt.figure(figsize=(12.5, 10))
draw(data, plt)
plt.legend(loc='upper center', borderpad=0, bbox_to_anchor=(0.5, 1.3), ncol=2, frameon=False, borderaxespad=2, prop={'size': 15})
plt.tight_layout(pad=12, w_pad=2, h_pad=1)
plt.savefig(output_file, bbox_inches='tight')
================================================
FILE: benchmarks/src/jmh/java/benchmarks/flow/scrabble/RxJava2PlaysScrabble.java
================================================
package benchmarks.flow.scrabble;
import benchmarks.flow.scrabble.IterableSpliterator;
import benchmarks.flow.scrabble.ShakespearePlaysScrabble;
import io.reactivex.Flowable;
import io.reactivex.Maybe;
import io.reactivex.Single;
import io.reactivex.functions.Function;
import org.openjdk.jmh.annotations.*;
import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
/**
* Shakespeare plays Scrabble with RxJava 2 Flowable.
* @author José
* @author akarnokd
*/
@Warmup(iterations = 7, time = 1, timeUnit = TimeUnit.SECONDS)
@Measurement(iterations = 7, time = 1, timeUnit = TimeUnit.SECONDS)
@Fork(value = 1)
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@State(Scope.Benchmark)
public class RxJava2PlaysScrabble extends ShakespearePlaysScrabble {
@Benchmark
@Override
public List<Entry<Integer, List<String>>> play() throws Exception {
// Function to compute the score of a given word
Function<Integer, Flowable<Integer>> scoreOfALetter = letter -> Flowable.just(letterScores[letter - 'a']) ;
// score of the same letters in a word
Function<Entry<Integer, LongWrapper>, Flowable<Integer>> letterScore =
entry ->
Flowable.just(
letterScores[entry.getKey() - 'a'] *
Integer.min(
(int)entry.getValue().get(),
scrabbleAvailableLetters[entry.getKey() - 'a']
)
) ;
Function<String, Flowable<Integer>> toIntegerFlowable =
string -> Flowable.fromIterable(IterableSpliterator.of(string.chars().boxed().spliterator())) ;
// Histogram of the letters in a given word
Function<String, Single<HashMap<Integer, LongWrapper>>> histoOfLetters =
word -> toIntegerFlowable.apply(word)
.collect(
() -> new HashMap<>(),
(HashMap<Integer, LongWrapper> map, Integer value) ->
{
LongWrapper newValue = map.get(value) ;
if (newValue == null) {
newValue = () -> 0L ;
}
map.put(value, newValue.incAndSet()) ;
}
) ;
// number of blanks for a given letter
Function<Entry<Integer, LongWrapper>, Flowable<Long>> blank =
entry ->
Flowable.just(
Long.max(
0L,
entry.getValue().get() -
scrabbleAvailableLetters[entry.getKey() - 'a']
)
) ;
// number of blanks for a given word
Function<String, Maybe<Long>> nBlanks =
word -> histoOfLetters.apply(word)
.flatMapPublisher(map -> Flowable.fromIterable(() -> map.entrySet().iterator()))
.flatMap(blank)
.reduce(Long::sum) ;
// can a word be written with 2 blanks?
Function<String, Maybe<Boolean>> checkBlanks =
word -> nBlanks.apply(word)
.flatMap(l -> Maybe.just(l <= 2L)) ;
// score taking blanks into account letterScore1
Function<String, Maybe<Integer>> score2 =
word -> histoOfLetters.apply(word)
.flatMapPublisher(map -> Flowable.fromIterable(() -> map.entrySet().iterator()))
.flatMap(letterScore)
.reduce(Integer::sum) ;
// Placing the word on the board
// Building the streams of first and last letters
Function<String, Flowable<Integer>> first3 =
word -> Flowable.fromIterable(IterableSpliterator.of(word.chars().boxed().limit(3).spliterator())) ;
Function<String, Flowable<Integer>> last3 =
word -> Flowable.fromIterable(IterableSpliterator.of(word.chars().boxed().skip(3).spliterator())) ;
// Stream to be maxed
Function<String, Flowable<Integer>> toBeMaxed =
word -> Flowable.just(first3.apply(word), last3.apply(word))
.flatMap(observable -> observable) ;
// Bonus for double letter
Function<String, Maybe<Integer>> bonusForDoubleLetter =
word -> toBeMaxed.apply(word)
.flatMap(scoreOfALetter)
.reduce(Integer::max) ;
// score of the word put on the board
Function<String, Maybe<Integer>> score3 =
word ->
Maybe.merge(Arrays.asList(
score2.apply(word),
score2.apply(word),
bonusForDoubleLetter.apply(word),
bonusForDoubleLetter.apply(word),
Maybe.just(word.length() == 7 ? 50 : 0)
)
)
.reduce(Integer::sum) ;
Function<Function<String, Maybe<Integer>>, Single<TreeMap<Integer, List<String>>>> buildHistoOnScore =
score -> Flowable.fromIterable(() -> shakespeareWords.iterator())
.filter(scrabbleWords::contains)
.filter(word -> checkBlanks.apply(word).blockingGet())
.collect(
() -> new TreeMap<>(Comparator.reverseOrder()),
(TreeMap<Integer, List<String>> map, String word) -> {
Integer key = score.apply(word).blockingGet() ;
List<String> list = map.get(key) ;
if (list == null) {
list = new ArrayList<>() ;
map.put(key, list) ;
}
list.add(word) ;
}
) ;
// best key / value pairs
List<Entry<Integer, List<String>>> finalList2 =
buildHistoOnScore.apply(score3)
.flatMapPublisher(map -> Flowable.fromIterable(() -> map.entrySet().iterator()))
.take(3)
.collect(
() -> new ArrayList<Entry<Integer, List<String>>>(),
(list, entry) -> {
list.add(entry) ;
}
)
.blockingGet() ;
return finalList2 ;
}
}
================================================
FILE: benchmarks/src/jmh/java/benchmarks/flow/scrabble/RxJava2PlaysScrabbleOpt.java
================================================
package benchmarks.flow.scrabble;
import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
import hu.akarnokd.rxjava2.math.MathFlowable;
import org.openjdk.jmh.annotations.*;
import benchmarks.flow.scrabble.optimizations.*;
import io.reactivex.*;
import io.reactivex.functions.Function;
/**
* Shakespeare plays Scrabble with RxJava 2 Flowable optimized.
* @author José
* @author akarnokd
*/
@Warmup(iterations = 7, time = 1, timeUnit = TimeUnit.SECONDS)
@Measurement(iterations = 7, time = 1, timeUnit = TimeUnit.SECONDS)
@Fork(value = 1)
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@State(Scope.Benchmark)
public class RxJava2PlaysScrabbleOpt extends ShakespearePlaysScrabble {
static Flowable<Integer> chars(String word) {
// return Flowable.range(0, word.length()).map(i -> (int)word.charAt(i));
return StringFlowable.characters(word);
}
@Benchmark
@Override
public List<Entry<Integer, List<String>>> play() throws Exception {
// to compute the score of a given word
Function<Integer, Integer> scoreOfALetter = letter -> letterScores[letter - 'a'];
// score of the same letters in a word
Function<Entry<Integer, MutableLong>, Integer> letterScore =
entry ->
letterScores[entry.getKey() - 'a'] *
Integer.min(
(int)entry.getValue().get(),
scrabbleAvailableLetters[entry.getKey() - 'a']
)
;
Function<String, Flowable<Integer>> toIntegerFlowable =
string -> chars(string);
Map<String, Single<HashMap<Integer, MutableLong>>> histoCache = new HashMap<>();
// Histogram of the letters in a given word
Function<String, Single<HashMap<Integer, MutableLong>>> histoOfLetters =
word -> { Single<HashMap<Integer, MutableLong>> s = histoCache.get(word);
if (s == null) {
s = toIntegerFlowable.apply(word)
.collect(
() -> new HashMap<>(),
(HashMap<Integer, MutableLong> map, Integer value) ->
{
MutableLong newValue = map.get(value) ;
if (newValue == null) {
newValue = new MutableLong();
map.put(value, newValue);
}
newValue.incAndSet();
}
);
histoCache.put(word, s);
}
return s;
};
// number of blanks for a given letter
Function<Entry<Integer, MutableLong>, Long> blank =
entry ->
Long.max(
0L,
entry.getValue().get() -
scrabbleAvailableLetters[entry.getKey() - 'a']
)
;
// number of blanks for a given word
Function<String, Flowable<Long>> nBlanks =
word -> MathFlowable.sumLong(
histoOfLetters.apply(word).flattenAsFlowable(
map -> map.entrySet()
)
.map(blank)
)
;
// can a word be written with 2 blanks?
Function<String, Flowable<Boolean>> checkBlanks =
word -> nBlanks.apply(word)
.map(l -> l <= 2L) ;
// score taking blanks into account letterScore1
Function<String, Flowable<Integer>> score2 =
word -> MathFlowable.sumInt(
histoOfLetters.apply(word).flattenAsFlowable(
map -> map.entrySet()
)
.map(letterScore)
) ;
// Placing the word on the board
// Building the streams of first and last letters
Function<String, Flowable<Integer>> first3 =
word -> chars(word).take(3) ;
Function<String, Flowable<Integer>> last3 =
word -> chars(word).skip(3) ;
// Stream to be maxed
Function<String, Flowable<Integer>> toBeMaxed =
word -> Flowable.concat(first3.apply(word), last3.apply(word))
;
// Bonus for double letter
Function<String, Flowable<Integer>> bonusForDoubleLetter =
word -> MathFlowable.max(toBeMaxed.apply(word)
.map(scoreOfALetter)
) ;
// score of the word put on the board
Function<String, Flowable<Integer>> score3 =
word ->
MathFlowable.sumInt(Flowable.concat(
score2.apply(word),
bonusForDoubleLetter.apply(word)
)).map(v -> v * 2 + (word.length() == 7 ? 50 : 0));
Function<Function<String, Flowable<Integer>>, Single<TreeMap<Integer, List<String>>>> buildHistoOnScore =
score -> Flowable.fromIterable(shakespeareWords)
.filter(scrabbleWords::contains)
.filter(word -> checkBlanks.apply(word).blockingFirst())
.collect(
() -> new TreeMap<Integer, List<String>>(Comparator.reverseOrder()),
(TreeMap<Integer, List<String>> map, String word) -> {
Integer key = score.apply(word).blockingFirst() ;
List<String> list = map.get(key) ;
if (list == null) {
list = new ArrayList<>() ;
map.put(key, list) ;
}
list.add(word) ;
}
) ;
// best key / value pairs
List<Entry<Integer, List<String>>> finalList2 =
buildHistoOnScore.apply(score3).flattenAsFlowable(
map -> map.entrySet()
)
.take(3)
.collect(
() -> new ArrayList<Entry<Integer, List<String>>>(),
(list, entry) -> {
list.add(entry) ;
}
)
.blockingGet();
return finalList2 ;
}
}
================================================
FILE: benchmarks/src/jmh/java/benchmarks/flow/scrabble/optimizations/FlowableCharSequence.java
================================================
package benchmarks.flow.scrabble.optimizations;
import io.reactivex.Flowable;
import io.reactivex.internal.fuseable.QueueFuseable;
import io.reactivex.internal.subscriptions.BasicQueueSubscription;
import io.reactivex.internal.subscriptions.SubscriptionHelper;
import io.reactivex.internal.util.BackpressureHelper;
import org.reactivestreams.Subscriber;
final class FlowableCharSequence extends Flowable<Integer> {
final CharSequence string;
FlowableCharSequence(CharSequence string) {
this.string = string;
}
@Override
public void subscribeActual(Subscriber<? super Integer> s) {
s.onSubscribe(new CharSequenceSubscription(s, string));
}
static final class CharSequenceSubscription
extends BasicQueueSubscription<Integer> {
gitextract_93h8727g/
├── .github/
│ └── ISSUE_TEMPLATE/
│ ├── bug_report.md
│ ├── config.yml
│ ├── design_considerations.md
│ ├── feature_request.md
│ ├── guide.md
│ └── rc_feedback.md
├── .gitignore
├── .idea/
│ ├── codeStyleSettings.xml
│ ├── codeStyles/
│ │ ├── Project.xml
│ │ └── codeStyleConfig.xml
│ ├── copyright/
│ │ └── profiles_settings.xml
│ ├── dictionaries/
│ │ └── shared.xml
│ └── vcs.xml
├── CHANGES.md
├── CHANGES_UP_TO_1.7.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE.txt
├── README.md
├── RELEASE.md
├── benchmarks/
│ ├── build.gradle.kts
│ ├── scripts/
│ │ └── generate_plots_flow_flatten_merge.py
│ └── src/
│ ├── jmh/
│ │ ├── java/
│ │ │ └── benchmarks/
│ │ │ └── flow/
│ │ │ └── scrabble/
│ │ │ ├── RxJava2PlaysScrabble.java
│ │ │ ├── RxJava2PlaysScrabbleOpt.java
│ │ │ └── optimizations/
│ │ │ ├── FlowableCharSequence.java
│ │ │ ├── FlowableSplit.java
│ │ │ └── StringFlowable.java
│ │ └── kotlin/
│ │ └── benchmarks/
│ │ ├── ChannelSinkBenchmark.kt
│ │ ├── ChannelSinkDepthBenchmark.kt
│ │ ├── ChannelSinkNoAllocationsBenchmark.kt
│ │ ├── ParametrizedDispatcherBase.kt
│ │ ├── SequentialSemaphoreBenchmark.kt
│ │ ├── akka/
│ │ │ ├── PingPongAkkaBenchmark.kt
│ │ │ └── StatefulActorAkkaBenchmark.kt
│ │ ├── debug/
│ │ │ └── DebugSequenceOverheadBenchmark.kt
│ │ ├── flow/
│ │ │ ├── CombineFlowsBenchmark.kt
│ │ │ ├── CombineTwoFlowsBenchmark.kt
│ │ │ ├── FlatMapMergeBenchmark.kt
│ │ │ ├── FlowFlattenMergeBenchmark.kt
│ │ │ ├── NumbersBenchmark.kt
│ │ │ ├── SafeFlowBenchmark.kt
│ │ │ ├── TakeBenchmark.kt
│ │ │ └── scrabble/
│ │ │ ├── FlowPlaysScrabbleBase.kt
│ │ │ ├── FlowPlaysScrabbleOpt.kt
│ │ │ ├── IterableSpliterator.kt
│ │ │ ├── README.md
│ │ │ ├── ReactorPlaysScrabble.kt
│ │ │ ├── SaneFlowPlaysScrabble.kt
│ │ │ ├── SequencePlaysScrabble.kt
│ │ │ └── ShakespearePlaysScrabble.kt
│ │ └── scheduler/
│ │ ├── DispatchersContextSwitchBenchmark.kt
│ │ ├── ForkJoinBenchmark.kt
│ │ ├── LaunchBenchmark.kt
│ │ ├── StatefulAwaitsBenchmark.kt
│ │ └── actors/
│ │ ├── ConcurrentStatefulActorBenchmark.kt
│ │ ├── CycledActorsBenchmark.kt
│ │ ├── PingPongActorBenchmark.kt
│ │ ├── PingPongWithBlockingContext.kt
│ │ └── StatefulActorBenchmark.kt
│ └── main/
│ └── kotlin/
│ └── benchmarks/
│ └── common/
│ └── BenchmarkUtils.kt
├── build.gradle.kts
├── buildSrc/
│ ├── build.gradle.kts
│ ├── settings.gradle.kts
│ └── src/
│ └── main/
│ └── kotlin/
│ ├── AuxBuildConfiguration.kt
│ ├── CacheRedirector.kt
│ ├── CommunityProjectsBuild.kt
│ ├── Dokka.kt
│ ├── GlobalKotlinCompilerOptions.kt
│ ├── Idea.kt
│ ├── Java9Modularity.kt
│ ├── Platform.kt
│ ├── Projects.kt
│ ├── Publishing.kt
│ ├── SourceSets.kt
│ ├── UnpackAar.kt
│ ├── VersionFile.kt
│ ├── animalsniffer-jvm-conventions.gradle.kts
│ ├── animalsniffer-multiplatform-conventions.gradle.kts
│ ├── bom-conventions.gradle.kts
│ ├── configure-compilation-conventions.gradle.kts
│ ├── dokka-conventions.gradle.kts
│ ├── java-modularity-conventions.gradle.kts
│ ├── knit-conventions.gradle.kts
│ ├── kotlin-jvm-conventions.gradle.kts
│ ├── kotlin-multiplatform-conventions.gradle.kts
│ ├── kover-conventions.gradle.kts
│ ├── pub-conventions.gradle.kts
│ ├── source-set-conventions.gradle.kts
│ └── version-file-conventions.gradle.kts
├── bump-version.sh
├── coroutines-guide.md
├── docs/
│ ├── basics.md
│ ├── cancellation-and-timeouts.md
│ ├── cfg/
│ │ └── buildprofiles.xml
│ ├── channels.md
│ ├── compatibility.md
│ ├── composing-suspending-functions.md
│ ├── coroutine-context-and-dispatchers.md
│ ├── coroutines-guide.md
│ ├── debugging.md
│ ├── exception-handling.md
│ ├── flow.md
│ ├── kc.tree
│ ├── knit.code.include
│ ├── knit.test.template
│ ├── select-expression.md
│ ├── shared-mutable-state-and-concurrency.md
│ ├── topics/
│ │ ├── cancellation-and-timeouts.md
│ │ ├── channels.md
│ │ ├── compatibility.md
│ │ ├── composing-suspending-functions.md
│ │ ├── coroutine-context-and-dispatchers.md
│ │ ├── coroutines-and-channels.md
│ │ ├── coroutines-basics.md
│ │ ├── coroutines-guide.md
│ │ ├── debug-coroutines-with-idea.md
│ │ ├── debug-flow-with-idea.md
│ │ ├── debugging.md
│ │ ├── exception-handling.md
│ │ ├── flow.md
│ │ ├── knit.properties
│ │ ├── select-expression.md
│ │ └── shared-mutable-state-and-concurrency.md
│ └── writerside.cfg
├── dokka-templates/
│ └── README.md
├── gradle/
│ └── wrapper/
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── integration/
│ ├── README.md
│ ├── kotlinx-coroutines-guava/
│ │ ├── README.md
│ │ ├── api/
│ │ │ └── kotlinx-coroutines-guava.api
│ │ ├── build.gradle.kts
│ │ ├── package.list
│ │ ├── src/
│ │ │ ├── ListenableFuture.kt
│ │ │ └── module-info.java
│ │ └── test/
│ │ ├── FutureAsDeferredUnhandledCompletionExceptionTest.kt
│ │ ├── ListenableFutureExceptionsTest.kt
│ │ ├── ListenableFutureTest.kt
│ │ └── ListenableFutureToStringTest.kt
│ ├── kotlinx-coroutines-jdk8/
│ │ ├── README.md
│ │ ├── api/
│ │ │ └── kotlinx-coroutines-jdk8.api
│ │ ├── build.gradle.kts
│ │ └── src/
│ │ └── module-info.java
│ ├── kotlinx-coroutines-play-services/
│ │ ├── README.md
│ │ ├── api/
│ │ │ └── kotlinx-coroutines-play-services.api
│ │ ├── build.gradle.kts
│ │ ├── package.list
│ │ ├── src/
│ │ │ └── Tasks.kt
│ │ └── test/
│ │ ├── FakeAndroid.kt
│ │ └── TaskTest.kt
│ └── kotlinx-coroutines-slf4j/
│ ├── README.md
│ ├── api/
│ │ └── kotlinx-coroutines-slf4j.api
│ ├── build.gradle.kts
│ ├── package.list
│ ├── src/
│ │ ├── MDCContext.kt
│ │ └── module-info.java
│ ├── test/
│ │ └── MDCContextTest.kt
│ └── test-resources/
│ └── logback-test.xml
├── integration-testing/
│ ├── .gitignore
│ ├── README.md
│ ├── build.gradle.kts
│ ├── gradle/
│ │ └── wrapper/
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── gradle.properties
│ ├── gradlew
│ ├── gradlew.bat
│ ├── java8Test/
│ │ ├── build.gradle.kts
│ │ └── src/
│ │ └── test/
│ │ └── kotlin/
│ │ └── JUnit5TimeoutCompilation.kt
│ ├── jpmsTest/
│ │ ├── build.gradle.kts
│ │ └── src/
│ │ └── debugDynamicAgentJpmsTest/
│ │ ├── java/
│ │ │ └── module-info.java
│ │ └── kotlin/
│ │ └── DynamicAttachDebugJpmsTest.kt
│ ├── settings.gradle.kts
│ ├── smokeTest/
│ │ ├── build.gradle.kts
│ │ └── src/
│ │ ├── commonMain/
│ │ │ └── kotlin/
│ │ │ └── Sample.kt
│ │ └── commonTest/
│ │ └── kotlin/
│ │ └── SampleTest.kt
│ └── src/
│ ├── coreAgentTest/
│ │ └── kotlin/
│ │ └── CoreAgentTest.kt
│ ├── debugAgentTest/
│ │ └── kotlin/
│ │ ├── DebugAgentTest.kt
│ │ ├── DebugProbes.kt
│ │ └── PrecompiledDebugProbesTest.kt
│ ├── debugDynamicAgentTest/
│ │ └── kotlin/
│ │ └── DynamicAttachDebugTest.kt
│ ├── jvmCoreTest/
│ │ └── kotlin/
│ │ ├── Jdk8InCoreIntegration.kt
│ │ └── ListAllCoroutineThrowableSubclassesTest.kt
│ └── mavenTest/
│ └── kotlin/
│ ├── MavenPublicationAtomicfuValidator.kt
│ ├── MavenPublicationMetaInfValidator.kt
│ └── MavenPublicationVersionValidator.kt
├── knit.properties
├── kotlinx-coroutines-bom/
│ └── build.gradle.kts
├── kotlinx-coroutines-core/
│ ├── README.md
│ ├── api/
│ │ ├── kotlinx-coroutines-core.api
│ │ └── kotlinx-coroutines-core.klib.api
│ ├── benchmarks/
│ │ ├── README.md
│ │ ├── jvm/
│ │ │ └── kotlin/
│ │ │ └── kotlinx/
│ │ │ └── coroutines/
│ │ │ ├── BenchmarkUtils.kt
│ │ │ ├── SemaphoreBenchmark.kt
│ │ │ ├── channels/
│ │ │ │ ├── ChannelProducerConsumerBenchmark.kt
│ │ │ │ ├── SelectBenchmark.kt
│ │ │ │ ├── SimpleChannel.kt
│ │ │ │ └── SimpleChannelBenchmark.kt
│ │ │ └── flow/
│ │ │ └── TakeWhileBenchmark.kt
│ │ └── main/
│ │ └── kotlin/
│ │ └── SharedFlowBaseline.kt
│ ├── build.gradle.kts
│ ├── common/
│ │ ├── README.md
│ │ ├── src/
│ │ │ ├── AbstractCoroutine.kt
│ │ │ ├── Annotations.kt
│ │ │ ├── Await.kt
│ │ │ ├── Builders.common.kt
│ │ │ ├── CancellableContinuation.kt
│ │ │ ├── CancellableContinuationImpl.kt
│ │ │ ├── CloseableCoroutineDispatcher.kt
│ │ │ ├── CompletableDeferred.kt
│ │ │ ├── CompletableJob.kt
│ │ │ ├── CompletionHandler.common.kt
│ │ │ ├── CompletionState.kt
│ │ │ ├── CoroutineContext.common.kt
│ │ │ ├── CoroutineDispatcher.kt
│ │ │ ├── CoroutineExceptionHandler.kt
│ │ │ ├── CoroutineName.kt
│ │ │ ├── CoroutineScope.kt
│ │ │ ├── CoroutineStart.kt
│ │ │ ├── Debug.common.kt
│ │ │ ├── Deferred.kt
│ │ │ ├── Delay.kt
│ │ │ ├── Dispatchers.common.kt
│ │ │ ├── EventLoop.common.kt
│ │ │ ├── Exceptions.common.kt
│ │ │ ├── Guidance.kt
│ │ │ ├── Job.kt
│ │ │ ├── JobSupport.kt
│ │ │ ├── MainCoroutineDispatcher.kt
│ │ │ ├── NonCancellable.kt
│ │ │ ├── Runnable.common.kt
│ │ │ ├── SchedulerTask.common.kt
│ │ │ ├── Supervisor.kt
│ │ │ ├── Timeout.kt
│ │ │ ├── Unconfined.kt
│ │ │ ├── Waiter.kt
│ │ │ ├── Yield.kt
│ │ │ ├── channels/
│ │ │ │ ├── Broadcast.kt
│ │ │ │ ├── BroadcastChannel.kt
│ │ │ │ ├── BufferOverflow.kt
│ │ │ │ ├── BufferedChannel.kt
│ │ │ │ ├── Channel.kt
│ │ │ │ ├── ChannelCoroutine.kt
│ │ │ │ ├── Channels.common.kt
│ │ │ │ ├── ConflatedBufferedChannel.kt
│ │ │ │ ├── Deprecated.kt
│ │ │ │ └── Produce.kt
│ │ │ ├── flow/
│ │ │ │ ├── Builders.kt
│ │ │ │ ├── Channels.kt
│ │ │ │ ├── Flow.kt
│ │ │ │ ├── FlowCollector.kt
│ │ │ │ ├── Migration.kt
│ │ │ │ ├── SharedFlow.kt
│ │ │ │ ├── SharingStarted.kt
│ │ │ │ ├── StateFlow.kt
│ │ │ │ ├── internal/
│ │ │ │ │ ├── AbstractSharedFlow.kt
│ │ │ │ │ ├── ChannelFlow.kt
│ │ │ │ │ ├── Combine.kt
│ │ │ │ │ ├── FlowCoroutine.kt
│ │ │ │ │ ├── FlowExceptions.common.kt
│ │ │ │ │ ├── Merge.kt
│ │ │ │ │ ├── NopCollector.kt
│ │ │ │ │ ├── NullSurrogate.kt
│ │ │ │ │ ├── SafeCollector.common.kt
│ │ │ │ │ └── SendingCollector.kt
│ │ │ │ ├── operators/
│ │ │ │ │ ├── Context.kt
│ │ │ │ │ ├── Delay.kt
│ │ │ │ │ ├── Distinct.kt
│ │ │ │ │ ├── Emitters.kt
│ │ │ │ │ ├── Errors.kt
│ │ │ │ │ ├── Limit.kt
│ │ │ │ │ ├── Lint.kt
│ │ │ │ │ ├── Merge.kt
│ │ │ │ │ ├── Share.kt
│ │ │ │ │ ├── Transform.kt
│ │ │ │ │ └── Zip.kt
│ │ │ │ └── terminal/
│ │ │ │ ├── Collect.kt
│ │ │ │ ├── Collection.kt
│ │ │ │ ├── Count.kt
│ │ │ │ ├── Logic.kt
│ │ │ │ └── Reduce.kt
│ │ │ ├── internal/
│ │ │ │ ├── Concurrent.common.kt
│ │ │ │ ├── ConcurrentLinkedList.kt
│ │ │ │ ├── CoroutineExceptionHandlerImpl.common.kt
│ │ │ │ ├── DispatchedContinuation.kt
│ │ │ │ ├── DispatchedTask.kt
│ │ │ │ ├── InlineList.kt
│ │ │ │ ├── InternalAnnotations.common.kt
│ │ │ │ ├── LimitedDispatcher.kt
│ │ │ │ ├── LocalAtomics.common.kt
│ │ │ │ ├── LockFreeLinkedList.common.kt
│ │ │ │ ├── LockFreeTaskQueue.kt
│ │ │ │ ├── MainDispatcherFactory.kt
│ │ │ │ ├── NamedDispatcher.kt
│ │ │ │ ├── OnUndeliveredElement.kt
│ │ │ │ ├── ProbesSupport.common.kt
│ │ │ │ ├── Scopes.kt
│ │ │ │ ├── StackTraceRecovery.common.kt
│ │ │ │ ├── Symbol.kt
│ │ │ │ ├── Synchronized.common.kt
│ │ │ │ ├── SystemProps.common.kt
│ │ │ │ ├── ThreadContext.common.kt
│ │ │ │ ├── ThreadLocal.common.kt
│ │ │ │ └── ThreadSafeHeap.kt
│ │ │ ├── intrinsics/
│ │ │ │ ├── Cancellable.kt
│ │ │ │ └── Undispatched.kt
│ │ │ ├── selects/
│ │ │ │ ├── OnTimeout.kt
│ │ │ │ ├── Select.kt
│ │ │ │ ├── SelectOld.kt
│ │ │ │ ├── SelectUnbiased.kt
│ │ │ │ └── WhileSelect.kt
│ │ │ └── sync/
│ │ │ ├── Mutex.kt
│ │ │ └── Semaphore.kt
│ │ └── test/
│ │ ├── AbstractCoroutineTest.kt
│ │ ├── AsyncLazyTest.kt
│ │ ├── AsyncTest.kt
│ │ ├── AtomicCancellationCommonTest.kt
│ │ ├── AwaitCancellationTest.kt
│ │ ├── AwaitTest.kt
│ │ ├── BuilderContractsTest.kt
│ │ ├── CancellableContinuationHandlersTest.kt
│ │ ├── CancellableContinuationTest.kt
│ │ ├── CancellableResumeOldTest.kt
│ │ ├── CancellableResumeTest.kt
│ │ ├── CancelledParentAttachTest.kt
│ │ ├── CompletableDeferredTest.kt
│ │ ├── CompletableJobTest.kt
│ │ ├── CoroutineDispatcherOperatorFunInvokeTest.kt
│ │ ├── CoroutineExceptionHandlerTest.kt
│ │ ├── CoroutineScopeTest.kt
│ │ ├── CoroutinesTest.kt
│ │ ├── DelayDurationTest.kt
│ │ ├── DelayTest.kt
│ │ ├── DispatchedContinuationTest.kt
│ │ ├── DurationToMillisTest.kt
│ │ ├── EmptyContext.kt
│ │ ├── FailedJobTest.kt
│ │ ├── ImmediateYieldTest.kt
│ │ ├── JobExtensionsTest.kt
│ │ ├── JobStatesTest.kt
│ │ ├── JobTest.kt
│ │ ├── LaunchLazyTest.kt
│ │ ├── LimitedParallelismSharedTest.kt
│ │ ├── NonCancellableTest.kt
│ │ ├── ParentCancellationTest.kt
│ │ ├── SupervisorTest.kt
│ │ ├── UnconfinedCancellationTest.kt
│ │ ├── UnconfinedTest.kt
│ │ ├── UndispatchedResultTest.kt
│ │ ├── WithContextTest.kt
│ │ ├── WithTimeoutDurationTest.kt
│ │ ├── WithTimeoutOrNullDurationTest.kt
│ │ ├── WithTimeoutOrNullTest.kt
│ │ ├── WithTimeoutTest.kt
│ │ ├── channels/
│ │ │ ├── BasicOperationsTest.kt
│ │ │ ├── BroadcastChannelFactoryTest.kt
│ │ │ ├── BroadcastTest.kt
│ │ │ ├── BufferedBroadcastChannelTest.kt
│ │ │ ├── BufferedChannelTest.kt
│ │ │ ├── ChannelBufferOverflowTest.kt
│ │ │ ├── ChannelFactoryTest.kt
│ │ │ ├── ChannelReceiveCatchingTest.kt
│ │ │ ├── ChannelUndeliveredElementFailureTest.kt
│ │ │ ├── ChannelUndeliveredElementTest.kt
│ │ │ ├── ChannelsTest.kt
│ │ │ ├── ConflatedBroadcastChannelTest.kt
│ │ │ ├── ConflatedChannelTest.kt
│ │ │ ├── ConsumeTest.kt
│ │ │ ├── ProduceConsumeTest.kt
│ │ │ ├── ProduceTest.kt
│ │ │ ├── RendezvousChannelTest.kt
│ │ │ ├── SendReceiveStressTest.kt
│ │ │ ├── TestBroadcastChannelKind.kt
│ │ │ ├── TestChannelKind.kt
│ │ │ └── UnlimitedChannelTest.kt
│ │ ├── flow/
│ │ │ ├── BuildersTest.kt
│ │ │ ├── FlowInvariantsTest.kt
│ │ │ ├── IdFlowTest.kt
│ │ │ ├── NamedDispatchers.kt
│ │ │ ├── SafeFlowTest.kt
│ │ │ ├── VirtualTime.kt
│ │ │ ├── channels/
│ │ │ │ ├── ChannelBuildersFlowTest.kt
│ │ │ │ ├── ChannelFlowTest.kt
│ │ │ │ └── FlowCallbackTest.kt
│ │ │ ├── internal/
│ │ │ │ └── FlowScopeTest.kt
│ │ │ ├── operators/
│ │ │ │ ├── BooleanTerminationTest.kt
│ │ │ │ ├── BufferConflationTest.kt
│ │ │ │ ├── BufferTest.kt
│ │ │ │ ├── CancellableTest.kt
│ │ │ │ ├── CatchTest.kt
│ │ │ │ ├── ChunkedTest.kt
│ │ │ │ ├── CombineParametersTest.kt
│ │ │ │ ├── CombineTest.kt
│ │ │ │ ├── ConflateTest.kt
│ │ │ │ ├── DebounceTest.kt
│ │ │ │ ├── DistinctUntilChangedTest.kt
│ │ │ │ ├── DropTest.kt
│ │ │ │ ├── DropWhileTest.kt
│ │ │ │ ├── FilterTest.kt
│ │ │ │ ├── FilterTrivialTest.kt
│ │ │ │ ├── FlatMapBaseTest.kt
│ │ │ │ ├── FlatMapConcatTest.kt
│ │ │ │ ├── FlatMapLatestTest.kt
│ │ │ │ ├── FlatMapMergeBaseTest.kt
│ │ │ │ ├── FlatMapMergeFastPathTest.kt
│ │ │ │ ├── FlatMapMergeTest.kt
│ │ │ │ ├── FlattenConcatTest.kt
│ │ │ │ ├── FlattenMergeTest.kt
│ │ │ │ ├── FlowContextOptimizationsTest.kt
│ │ │ │ ├── FlowOnTest.kt
│ │ │ │ ├── IndexedTest.kt
│ │ │ │ ├── LintTest.kt
│ │ │ │ ├── MapNotNullTest.kt
│ │ │ │ ├── MapTest.kt
│ │ │ │ ├── MergeTest.kt
│ │ │ │ ├── OnCompletionTest.kt
│ │ │ │ ├── OnEachTest.kt
│ │ │ │ ├── OnEmptyTest.kt
│ │ │ │ ├── OnStartTest.kt
│ │ │ │ ├── RetryTest.kt
│ │ │ │ ├── SampleTest.kt
│ │ │ │ ├── ScanTest.kt
│ │ │ │ ├── TakeTest.kt
│ │ │ │ ├── TakeWhileTest.kt
│ │ │ │ ├── TimeoutTest.kt
│ │ │ │ ├── TransformLatestTest.kt
│ │ │ │ ├── TransformTest.kt
│ │ │ │ ├── TransformWhileTest.kt
│ │ │ │ └── ZipTest.kt
│ │ │ ├── sharing/
│ │ │ │ ├── ShareInBufferTest.kt
│ │ │ │ ├── ShareInConflationTest.kt
│ │ │ │ ├── ShareInFusionTest.kt
│ │ │ │ ├── ShareInTest.kt
│ │ │ │ ├── SharedFlowScenarioTest.kt
│ │ │ │ ├── SharedFlowTest.kt
│ │ │ │ ├── SharingStartedTest.kt
│ │ │ │ ├── SharingStartedWhileSubscribedTest.kt
│ │ │ │ ├── StateFlowTest.kt
│ │ │ │ └── StateInTest.kt
│ │ │ └── terminal/
│ │ │ ├── CollectLatestTest.kt
│ │ │ ├── CountTest.kt
│ │ │ ├── FirstTest.kt
│ │ │ ├── FoldTest.kt
│ │ │ ├── LastTest.kt
│ │ │ ├── LaunchInTest.kt
│ │ │ ├── ReduceTest.kt
│ │ │ ├── SingleTest.kt
│ │ │ └── ToCollectionTest.kt
│ │ ├── selects/
│ │ │ ├── SelectBiasTest.kt
│ │ │ ├── SelectBufferedChannelTest.kt
│ │ │ ├── SelectDeferredTest.kt
│ │ │ ├── SelectJobTest.kt
│ │ │ ├── SelectLoopTest.kt
│ │ │ ├── SelectMutexTest.kt
│ │ │ ├── SelectOldTest.kt
│ │ │ ├── SelectRendezvousChannelTest.kt
│ │ │ ├── SelectTimeoutDurationTest.kt
│ │ │ ├── SelectTimeoutTest.kt
│ │ │ └── SelectUnlimitedChannelTest.kt
│ │ └── sync/
│ │ ├── MutexTest.kt
│ │ └── SemaphoreTest.kt
│ ├── concurrent/
│ │ ├── src/
│ │ │ ├── Builders.concurrent.kt
│ │ │ ├── Dispatchers.kt
│ │ │ ├── MultithreadedDispatchers.common.kt
│ │ │ ├── channels/
│ │ │ │ └── Channels.kt
│ │ │ └── internal/
│ │ │ ├── LockFreeLinkedList.kt
│ │ │ └── OnDemandAllocatingPool.kt
│ │ └── test/
│ │ ├── AbstractDispatcherConcurrencyTest.kt
│ │ ├── AtomicCancellationTest.kt
│ │ ├── CommonThreadLocalTest.kt
│ │ ├── ConcurrentExceptionsStressTest.kt
│ │ ├── ConcurrentTestUtilities.common.kt
│ │ ├── DefaultDispatchersConcurrencyTest.kt
│ │ ├── JobStructuredJoinStressTest.kt
│ │ ├── LimitedParallelismConcurrentTest.kt
│ │ ├── MultithreadedDispatcherStressTest.kt
│ │ ├── RunBlockingTest.kt
│ │ ├── channels/
│ │ │ ├── BroadcastChannelSubStressTest.kt
│ │ │ ├── ChannelCancelUndeliveredElementStressTest.kt
│ │ │ ├── ConflatedBroadcastChannelNotifyStressTest.kt
│ │ │ └── TrySendBlockingTest.kt
│ │ ├── flow/
│ │ │ ├── CombineStressTest.kt
│ │ │ ├── FlowCancellationTest.kt
│ │ │ ├── StateFlowCommonStressTest.kt
│ │ │ └── StateFlowUpdateCommonTest.kt
│ │ ├── selects/
│ │ │ ├── SelectChannelStressTest.kt
│ │ │ └── SelectMutexStressTest.kt
│ │ └── sync/
│ │ ├── MutexStressTest.kt
│ │ └── SemaphoreStressTest.kt
│ ├── js/
│ │ ├── src/
│ │ │ ├── CoroutineContext.kt
│ │ │ ├── Debug.kt
│ │ │ ├── JSDispatcher.kt
│ │ │ ├── Promise.kt
│ │ │ ├── Window.kt
│ │ │ └── internal/
│ │ │ ├── CopyOnWriteList.kt
│ │ │ └── CoroutineExceptionHandlerImpl.kt
│ │ └── test/
│ │ └── PromiseTest.kt
│ ├── jsAndWasmJsShared/
│ │ ├── src/
│ │ │ ├── EventLoop.kt
│ │ │ └── internal/
│ │ │ └── JSDispatcher.kt
│ │ └── test/
│ │ ├── MessageQueueTest.kt
│ │ └── SetTimeoutDispatcherTest.kt
│ ├── jsAndWasmShared/
│ │ ├── src/
│ │ │ ├── CloseableCoroutineDispatcher.kt
│ │ │ ├── CoroutineContext.kt
│ │ │ ├── Dispatchers.kt
│ │ │ ├── Exceptions.kt
│ │ │ ├── Runnable.kt
│ │ │ ├── SchedulerTask.kt
│ │ │ ├── flow/
│ │ │ │ └── internal/
│ │ │ │ ├── FlowExceptions.kt
│ │ │ │ └── SafeCollector.kt
│ │ │ └── internal/
│ │ │ ├── Concurrent.kt
│ │ │ ├── CoroutineExceptionHandlerImpl.kt
│ │ │ ├── LinkedList.kt
│ │ │ ├── LocalAtomics.kt
│ │ │ ├── ProbesSupport.kt
│ │ │ ├── StackTraceRecovery.kt
│ │ │ ├── Synchronized.kt
│ │ │ ├── SystemProps.kt
│ │ │ ├── ThreadContext.kt
│ │ │ └── ThreadLocal.kt
│ │ └── test/
│ │ ├── ImmediateDispatcherTest.kt
│ │ └── internal/
│ │ └── LinkedListTest.kt
│ ├── jvm/
│ │ ├── resources/
│ │ │ └── META-INF/
│ │ │ ├── com.android.tools/
│ │ │ │ ├── proguard/
│ │ │ │ │ └── coroutines.pro
│ │ │ │ └── r8/
│ │ │ │ └── coroutines.pro
│ │ │ └── proguard/
│ │ │ └── coroutines.pro
│ │ ├── src/
│ │ │ ├── AbstractTimeSource.kt
│ │ │ ├── Builders.kt
│ │ │ ├── CoroutineContext.kt
│ │ │ ├── Debug.kt
│ │ │ ├── DebugStrings.kt
│ │ │ ├── DefaultExecutor.kt
│ │ │ ├── Dispatchers.kt
│ │ │ ├── EventLoop.kt
│ │ │ ├── Exceptions.kt
│ │ │ ├── Executors.kt
│ │ │ ├── Future.kt
│ │ │ ├── Interruptible.kt
│ │ │ ├── Runnable.kt
│ │ │ ├── SchedulerTask.kt
│ │ │ ├── ThreadContextElement.kt
│ │ │ ├── ThreadPoolDispatcher.kt
│ │ │ ├── channels/
│ │ │ │ ├── Actor.kt
│ │ │ │ └── TickerChannels.kt
│ │ │ ├── debug/
│ │ │ │ ├── CoroutineDebugging.kt
│ │ │ │ └── internal/
│ │ │ │ ├── AgentInstallationType.kt
│ │ │ │ ├── AgentPremain.kt
│ │ │ │ ├── ConcurrentWeakMap.kt
│ │ │ │ ├── DebugCoroutineInfo.kt
│ │ │ │ ├── DebugCoroutineInfoImpl.kt
│ │ │ │ ├── DebugProbes.kt
│ │ │ │ ├── DebugProbesImpl.kt
│ │ │ │ ├── DebuggerInfo.kt
│ │ │ │ └── StackTraceFrame.kt
│ │ │ ├── flow/
│ │ │ │ └── internal/
│ │ │ │ ├── FlowExceptions.kt
│ │ │ │ └── SafeCollector.kt
│ │ │ ├── future/
│ │ │ │ └── Future.kt
│ │ │ ├── internal/
│ │ │ │ ├── Concurrent.kt
│ │ │ │ ├── CoroutineExceptionHandlerImpl.kt
│ │ │ │ ├── ExceptionsConstructor.kt
│ │ │ │ ├── FastServiceLoader.kt
│ │ │ │ ├── InternalAnnotations.kt
│ │ │ │ ├── LocalAtomics.kt
│ │ │ │ ├── MainDispatchers.kt
│ │ │ │ ├── ProbesSupport.kt
│ │ │ │ ├── ResizableAtomicArray.kt
│ │ │ │ ├── StackTraceRecovery.kt
│ │ │ │ ├── Synchronized.kt
│ │ │ │ ├── SystemProps.kt
│ │ │ │ ├── ThreadContext.kt
│ │ │ │ └── ThreadLocal.kt
│ │ │ ├── module-info.java
│ │ │ ├── scheduling/
│ │ │ │ ├── CoroutineScheduler.kt
│ │ │ │ ├── Dispatcher.kt
│ │ │ │ ├── Tasks.kt
│ │ │ │ └── WorkQueue.kt
│ │ │ ├── stream/
│ │ │ │ └── Stream.kt
│ │ │ └── time/
│ │ │ └── Time.kt
│ │ ├── test/
│ │ │ ├── AbstractLincheckTest.kt
│ │ │ ├── AsyncJvmTest.kt
│ │ │ ├── AwaitJvmTest.kt
│ │ │ ├── AwaitStressTest.kt
│ │ │ ├── CancellableContinuationJvmTest.kt
│ │ │ ├── CancellableContinuationResumeCloseStressTest.kt
│ │ │ ├── CancelledAwaitStressTest.kt
│ │ │ ├── ConcurrentTestUtilities.kt
│ │ │ ├── CoroutinesJvmTest.kt
│ │ │ ├── DebugThreadNameTest.kt
│ │ │ ├── DefaultExecutorStressTest.kt
│ │ │ ├── DelayJvmTest.kt
│ │ │ ├── DispatcherKeyTest.kt
│ │ │ ├── DispatchersToStringTest.kt
│ │ │ ├── EventLoopsTest.kt
│ │ │ ├── ExecutorAsCoroutineDispatcherDelayTest.kt
│ │ │ ├── ExecutorsTest.kt
│ │ │ ├── FailFastOnStartTest.kt
│ │ │ ├── FailingCoroutinesMachineryTest.kt
│ │ │ ├── IODispatcherTest.kt
│ │ │ ├── IntellijIdeaDebuggerEvaluatorCompatibilityTest.kt
│ │ │ ├── JobActivationStressTest.kt
│ │ │ ├── JobCancellationExceptionSerializerTest.kt
│ │ │ ├── JobChildStressTest.kt
│ │ │ ├── JobDisposeStressTest.kt
│ │ │ ├── JobHandlersUpgradeStressTest.kt
│ │ │ ├── JobOnCompletionStressTest.kt
│ │ │ ├── JobStressTest.kt
│ │ │ ├── JoinStressTest.kt
│ │ │ ├── LimitedParallelismStressTest.kt
│ │ │ ├── LimitedParallelismUnhandledExceptionTest.kt
│ │ │ ├── MemoryFootprintTest.kt
│ │ │ ├── MultithreadedDispatchersJvmTest.kt
│ │ │ ├── MutexCancellationStressTest.kt
│ │ │ ├── NoParamAssertionsTest.kt
│ │ │ ├── RejectedExecutionTest.kt
│ │ │ ├── ReusableCancellableContinuationInvariantStressTest.kt
│ │ │ ├── ReusableCancellableContinuationLeakStressTest.kt
│ │ │ ├── ReusableCancellableContinuationTest.kt
│ │ │ ├── ReusableContinuationStressTest.kt
│ │ │ ├── RunBlockingJvmTest.kt
│ │ │ ├── RunInterruptibleStressTest.kt
│ │ │ ├── RunInterruptibleTest.kt
│ │ │ ├── TestBaseTest.kt
│ │ │ ├── ThreadContextElementRestoreTest.kt
│ │ │ ├── ThreadContextElementTest.kt
│ │ │ ├── ThreadContextMutableCopiesTest.kt
│ │ │ ├── ThreadContextOrderTest.kt
│ │ │ ├── ThreadLocalStressTest.kt
│ │ │ ├── ThreadLocalTest.kt
│ │ │ ├── ThreadLocalsLeaksTest.kt
│ │ │ ├── UnconfinedConcurrentStressTest.kt
│ │ │ ├── VirtualTimeSource.kt
│ │ │ ├── WithDefaultContextTest.kt
│ │ │ ├── WithTimeoutChildDispatchStressTest.kt
│ │ │ ├── WithTimeoutOrNullJvmTest.kt
│ │ │ ├── WithTimeoutOrNullThreadDispatchTest.kt
│ │ │ ├── WithTimeoutThreadDispatchTest.kt
│ │ │ ├── channels/
│ │ │ │ ├── ActorLazyTest.kt
│ │ │ │ ├── ActorTest.kt
│ │ │ │ ├── BroadcastChannelLeakTest.kt
│ │ │ │ ├── BroadcastChannelMultiReceiveStressTest.kt
│ │ │ │ ├── BufferedChannelStressTest.kt
│ │ │ │ ├── CancelledChannelLeakTest.kt
│ │ │ │ ├── ChannelMemoryLeakStressTest.kt
│ │ │ │ ├── ChannelSelectStressTest.kt
│ │ │ │ ├── ChannelSendReceiveStressTest.kt
│ │ │ │ ├── ChannelUndeliveredElementSelectOldStressTest.kt
│ │ │ │ ├── ChannelUndeliveredElementStressTest.kt
│ │ │ │ ├── ConflatedChannelCloseStressTest.kt
│ │ │ │ ├── DoubleChannelCloseStressTest.kt
│ │ │ │ ├── InvokeOnCloseStressTest.kt
│ │ │ │ ├── ProduceConsumeJvmTest.kt
│ │ │ │ ├── SendReceiveJvmStressTest.kt
│ │ │ │ ├── SimpleSendReceiveJvmTest.kt
│ │ │ │ ├── TickerChannelCommonTest.kt
│ │ │ │ └── TickerChannelTest.kt
│ │ │ ├── examples/
│ │ │ │ ├── example-delay-01.kt
│ │ │ │ ├── example-delay-02.kt
│ │ │ │ ├── example-delay-03.kt
│ │ │ │ ├── example-delay-duration-01.kt
│ │ │ │ ├── example-delay-duration-02.kt
│ │ │ │ ├── example-delay-duration-03.kt
│ │ │ │ ├── example-timeout-duration-01.kt
│ │ │ │ └── test/
│ │ │ │ └── FlowDelayTest.kt
│ │ │ ├── exceptions/
│ │ │ │ ├── CoroutineExceptionHandlerJvmTest.kt
│ │ │ │ ├── FlowSuppressionTest.kt
│ │ │ │ ├── JobBasicCancellationTest.kt
│ │ │ │ ├── JobExceptionHandlingTest.kt
│ │ │ │ ├── JobExceptionsStressTest.kt
│ │ │ │ ├── JobNestedExceptionsTest.kt
│ │ │ │ ├── ProduceExceptionsTest.kt
│ │ │ │ ├── StackTraceRecoveryChannelsTest.kt
│ │ │ │ ├── StackTraceRecoveryCustomExceptionsTest.kt
│ │ │ │ ├── StackTraceRecoveryNestedScopesTest.kt
│ │ │ │ ├── StackTraceRecoveryNestedTest.kt
│ │ │ │ ├── StackTraceRecoveryResumeModeTest.kt
│ │ │ │ ├── StackTraceRecoverySelectTest.kt
│ │ │ │ ├── StackTraceRecoveryTest.kt
│ │ │ │ ├── StackTraceRecoveryWithTimeoutTest.kt
│ │ │ │ ├── Stacktraces.kt
│ │ │ │ ├── SuppressionTests.kt
│ │ │ │ ├── WithContextCancellationStressTest.kt
│ │ │ │ └── WithContextExceptionHandlingTest.kt
│ │ │ ├── flow/
│ │ │ │ ├── CallbackFlowTest.kt
│ │ │ │ ├── ExceptionTransparencyTest.kt
│ │ │ │ ├── FirstJvmTest.kt
│ │ │ │ ├── FlatMapStressTest.kt
│ │ │ │ ├── OnCompletionInterceptedReleaseTest.kt
│ │ │ │ ├── SafeCollectorMemoryLeakTest.kt
│ │ │ │ ├── SharedFlowStressTest.kt
│ │ │ │ ├── SharingReferenceTest.kt
│ │ │ │ ├── SharingStressTest.kt
│ │ │ │ ├── StateFlowCancellabilityTest.kt
│ │ │ │ ├── StateFlowStressTest.kt
│ │ │ │ └── StateFlowUpdateStressTest.kt
│ │ │ ├── guide/
│ │ │ │ ├── example-basic-01.kt
│ │ │ │ ├── example-basic-02.kt
│ │ │ │ ├── example-basic-03.kt
│ │ │ │ ├── example-basic-04.kt
│ │ │ │ ├── example-basic-05.kt
│ │ │ │ ├── example-basic-06.kt
│ │ │ │ ├── example-cancel-01.kt
│ │ │ │ ├── example-cancel-02.kt
│ │ │ │ ├── example-cancel-03.kt
│ │ │ │ ├── example-cancel-04.kt
│ │ │ │ ├── example-cancel-05.kt
│ │ │ │ ├── example-cancel-06.kt
│ │ │ │ ├── example-cancel-07.kt
│ │ │ │ ├── example-cancel-08.kt
│ │ │ │ ├── example-cancel-09.kt
│ │ │ │ ├── example-cancel-10.kt
│ │ │ │ ├── example-channel-01.kt
│ │ │ │ ├── example-channel-02.kt
│ │ │ │ ├── example-channel-03.kt
│ │ │ │ ├── example-channel-04.kt
│ │ │ │ ├── example-channel-05.kt
│ │ │ │ ├── example-channel-06.kt
│ │ │ │ ├── example-channel-07.kt
│ │ │ │ ├── example-channel-08.kt
│ │ │ │ ├── example-channel-09.kt
│ │ │ │ ├── example-channel-10.kt
│ │ │ │ ├── example-compose-01.kt
│ │ │ │ ├── example-compose-02.kt
│ │ │ │ ├── example-compose-03.kt
│ │ │ │ ├── example-compose-04.kt
│ │ │ │ ├── example-compose-05.kt
│ │ │ │ ├── example-compose-06.kt
│ │ │ │ ├── example-context-01.kt
│ │ │ │ ├── example-context-02.kt
│ │ │ │ ├── example-context-03.kt
│ │ │ │ ├── example-context-04.kt
│ │ │ │ ├── example-context-05.kt
│ │ │ │ ├── example-context-06.kt
│ │ │ │ ├── example-context-07.kt
│ │ │ │ ├── example-context-08.kt
│ │ │ │ ├── example-context-09.kt
│ │ │ │ ├── example-context-10.kt
│ │ │ │ ├── example-context-11.kt
│ │ │ │ ├── example-exceptions-01.kt
│ │ │ │ ├── example-exceptions-02.kt
│ │ │ │ ├── example-exceptions-03.kt
│ │ │ │ ├── example-exceptions-04.kt
│ │ │ │ ├── example-exceptions-05.kt
│ │ │ │ ├── example-exceptions-06.kt
│ │ │ │ ├── example-flow-01.kt
│ │ │ │ ├── example-flow-02.kt
│ │ │ │ ├── example-flow-03.kt
│ │ │ │ ├── example-flow-04.kt
│ │ │ │ ├── example-flow-05.kt
│ │ │ │ ├── example-flow-06.kt
│ │ │ │ ├── example-flow-07.kt
│ │ │ │ ├── example-flow-08.kt
│ │ │ │ ├── example-flow-09.kt
│ │ │ │ ├── example-flow-10.kt
│ │ │ │ ├── example-flow-11.kt
│ │ │ │ ├── example-flow-12.kt
│ │ │ │ ├── example-flow-13.kt
│ │ │ │ ├── example-flow-14.kt
│ │ │ │ ├── example-flow-15.kt
│ │ │ │ ├── example-flow-16.kt
│ │ │ │ ├── example-flow-17.kt
│ │ │ │ ├── example-flow-18.kt
│ │ │ │ ├── example-flow-19.kt
│ │ │ │ ├── example-flow-20.kt
│ │ │ │ ├── example-flow-21.kt
│ │ │ │ ├── example-flow-22.kt
│ │ │ │ ├── example-flow-23.kt
│ │ │ │ ├── example-flow-24.kt
│ │ │ │ ├── example-flow-25.kt
│ │ │ │ ├── example-flow-26.kt
│ │ │ │ ├── example-flow-27.kt
│ │ │ │ ├── example-flow-28.kt
│ │ │ │ ├── example-flow-29.kt
│ │ │ │ ├── example-flow-30.kt
│ │ │ │ ├── example-flow-31.kt
│ │ │ │ ├── example-flow-32.kt
│ │ │ │ ├── example-flow-33.kt
│ │ │ │ ├── example-flow-34.kt
│ │ │ │ ├── example-flow-35.kt
│ │ │ │ ├── example-flow-36.kt
│ │ │ │ ├── example-flow-37.kt
│ │ │ │ ├── example-flow-38.kt
│ │ │ │ ├── example-flow-39.kt
│ │ │ │ ├── example-select-01.kt
│ │ │ │ ├── example-select-02.kt
│ │ │ │ ├── example-select-03.kt
│ │ │ │ ├── example-select-04.kt
│ │ │ │ ├── example-select-05.kt
│ │ │ │ ├── example-supervision-01.kt
│ │ │ │ ├── example-supervision-02.kt
│ │ │ │ ├── example-supervision-03.kt
│ │ │ │ ├── example-sync-01.kt
│ │ │ │ ├── example-sync-02.kt
│ │ │ │ ├── example-sync-03.kt
│ │ │ │ ├── example-sync-04.kt
│ │ │ │ ├── example-sync-05.kt
│ │ │ │ ├── example-sync-06.kt
│ │ │ │ ├── example-sync-07.kt
│ │ │ │ └── test/
│ │ │ │ ├── BasicsGuideTest.kt
│ │ │ │ ├── CancellationGuideTest.kt
│ │ │ │ ├── ChannelsGuideTest.kt
│ │ │ │ ├── ComposingGuideTest.kt
│ │ │ │ ├── DispatcherGuideTest.kt
│ │ │ │ ├── ExceptionsGuideTest.kt
│ │ │ │ ├── FlowGuideTest.kt
│ │ │ │ ├── SelectGuideTest.kt
│ │ │ │ └── SharedStateGuideTest.kt
│ │ │ ├── internal/
│ │ │ │ ├── ConcurrentWeakMapCollectionStressTest.kt
│ │ │ │ ├── ConcurrentWeakMapOperationStressTest.kt
│ │ │ │ ├── ConcurrentWeakMapTest.kt
│ │ │ │ ├── FastServiceLoaderTest.kt
│ │ │ │ ├── LockFreeLinkedListLongStressTest.kt
│ │ │ │ ├── LockFreeTaskQueueStressTest.kt
│ │ │ │ ├── LockFreeTaskQueueTest.kt
│ │ │ │ ├── OnDemandAllocatingPoolLincheckTest.kt
│ │ │ │ ├── ThreadSafeHeapStressTest.kt
│ │ │ │ └── ThreadSafeHeapTest.kt
│ │ │ ├── jdk8/
│ │ │ │ ├── future/
│ │ │ │ │ ├── AsFutureTest.kt
│ │ │ │ │ ├── FutureAsDeferredUnhandledCompletionExceptionTest.kt
│ │ │ │ │ ├── FutureExceptionsTest.kt
│ │ │ │ │ └── FutureTest.kt
│ │ │ │ ├── stream/
│ │ │ │ │ └── ConsumeAsFlowTest.kt
│ │ │ │ └── time/
│ │ │ │ ├── DurationOverflowTest.kt
│ │ │ │ ├── FlowDebounceTest.kt
│ │ │ │ ├── FlowSampleTest.kt
│ │ │ │ └── WithTimeoutTest.kt
│ │ │ ├── knit/
│ │ │ │ ├── ClosedAfterGuideTestExecutor.kt
│ │ │ │ └── TestUtil.kt
│ │ │ ├── lincheck/
│ │ │ │ ├── ChannelsLincheckTest.kt
│ │ │ │ ├── LockFreeTaskQueueLincheckTest.kt
│ │ │ │ ├── MutexLincheckTest.kt
│ │ │ │ ├── ResizableAtomicArrayLincheckTest.kt
│ │ │ │ └── SemaphoreLincheckTest.kt
│ │ │ ├── scheduling/
│ │ │ │ ├── BlockingCoroutineDispatcherLivenessStressTest.kt
│ │ │ │ ├── BlockingCoroutineDispatcherMixedStealingStressTest.kt
│ │ │ │ ├── BlockingCoroutineDispatcherTerminationStressTest.kt
│ │ │ │ ├── BlockingCoroutineDispatcherTest.kt
│ │ │ │ ├── BlockingCoroutineDispatcherThreadLimitStressTest.kt
│ │ │ │ ├── BlockingCoroutineDispatcherWorkSignallingStressTest.kt
│ │ │ │ ├── CoroutineDispatcherTest.kt
│ │ │ │ ├── CoroutineSchedulerCloseStressTest.kt
│ │ │ │ ├── CoroutineSchedulerInternalApiStressTest.kt
│ │ │ │ ├── CoroutineSchedulerLivenessStressTest.kt
│ │ │ │ ├── CoroutineSchedulerOversubscriptionTest.kt
│ │ │ │ ├── CoroutineSchedulerStressTest.kt
│ │ │ │ ├── CoroutineSchedulerTest.kt
│ │ │ │ ├── DefaultDispatchersTest.kt
│ │ │ │ ├── LimitingCoroutineDispatcherStressTest.kt
│ │ │ │ ├── LimitingDispatcherTest.kt
│ │ │ │ ├── SchedulerTestBase.kt
│ │ │ │ ├── SharingWorkerClassTest.kt
│ │ │ │ ├── TestTimeSource.kt
│ │ │ │ ├── WorkQueueStressTest.kt
│ │ │ │ └── WorkQueueTest.kt
│ │ │ └── selects/
│ │ │ ├── SelectDeadlockStressTest.kt
│ │ │ ├── SelectMemoryLeakStressTest.kt
│ │ │ └── SelectPhilosophersStressTest.kt
│ │ └── test-resources/
│ │ └── stacktraces/
│ │ ├── channels/
│ │ │ ├── testOfferFromScope.txt
│ │ │ ├── testOfferWithContextWrapped.txt
│ │ │ ├── testOfferWithCurrentContext.txt
│ │ │ ├── testReceiveFromChannel.txt
│ │ │ ├── testReceiveFromClosedChannel.txt
│ │ │ ├── testSendFromScope.txt
│ │ │ ├── testSendToChannel.txt
│ │ │ └── testSendToClosedChannel.txt
│ │ ├── resume-mode/
│ │ │ ├── testEventLoopDispatcher.txt
│ │ │ ├── testEventLoopDispatcherSuspending.txt
│ │ │ ├── testNestedEventLoopChangedContext.txt
│ │ │ ├── testNestedEventLoopChangedContextSuspending.txt
│ │ │ ├── testNestedEventLoopDispatcher.txt
│ │ │ ├── testNestedEventLoopDispatcherSuspending.txt
│ │ │ ├── testNestedUnconfined.txt
│ │ │ ├── testNestedUnconfinedChangedContext.txt
│ │ │ ├── testNestedUnconfinedChangedContextSuspending.txt
│ │ │ ├── testNestedUnconfinedSuspending.txt
│ │ │ ├── testUnconfined.txt
│ │ │ └── testUnconfinedSuspending.txt
│ │ ├── select/
│ │ │ ├── testSelectCompletedAwait.txt
│ │ │ ├── testSelectJoin.txt
│ │ │ └── testSelectOnReceive.txt
│ │ └── timeout/
│ │ ├── testStacktraceIsRecoveredFromLexicalBlockWhenTriggeredByChild.txt
│ │ ├── testStacktraceIsRecoveredFromSuspensionPoint.txt
│ │ └── testStacktraceIsRecoveredFromSuspensionPointWithChild.txt
│ ├── knit.properties
│ ├── native/
│ │ ├── src/
│ │ │ ├── Builders.kt
│ │ │ ├── CloseableCoroutineDispatcher.kt
│ │ │ ├── CoroutineContext.kt
│ │ │ ├── Debug.kt
│ │ │ ├── Dispatchers.kt
│ │ │ ├── EventLoop.kt
│ │ │ ├── Exceptions.kt
│ │ │ ├── MultithreadedDispatchers.kt
│ │ │ ├── Runnable.kt
│ │ │ ├── SchedulerTask.kt
│ │ │ ├── flow/
│ │ │ │ └── internal/
│ │ │ │ ├── FlowExceptions.kt
│ │ │ │ └── SafeCollector.kt
│ │ │ └── internal/
│ │ │ ├── Concurrent.kt
│ │ │ ├── CopyOnWriteList.kt
│ │ │ ├── CoroutineExceptionHandlerImpl.kt
│ │ │ ├── LocalAtomics.kt
│ │ │ ├── ProbesSupport.kt
│ │ │ ├── StackTraceRecovery.kt
│ │ │ ├── Synchronized.kt
│ │ │ ├── SystemProps.kt
│ │ │ ├── ThreadContext.kt
│ │ │ └── ThreadLocal.kt
│ │ └── test/
│ │ ├── ConcurrentTestUtilities.kt
│ │ ├── DelayExceptionTest.kt
│ │ ├── MultithreadedDispatchersTest.kt
│ │ └── WorkerTest.kt
│ ├── nativeDarwin/
│ │ ├── src/
│ │ │ └── Dispatchers.kt
│ │ └── test/
│ │ ├── Launcher.kt
│ │ └── MainDispatcherTest.kt
│ ├── nativeOther/
│ │ ├── src/
│ │ │ └── Dispatchers.kt
│ │ └── test/
│ │ └── Launcher.kt
│ ├── wasmJs/
│ │ ├── src/
│ │ │ ├── CoroutineContext.kt
│ │ │ ├── Debug.kt
│ │ │ ├── JSDispatcher.kt
│ │ │ ├── Promise.kt
│ │ │ └── internal/
│ │ │ ├── CopyOnWriteList.kt
│ │ │ └── CoroutineExceptionHandlerImpl.kt
│ │ └── test/
│ │ └── PromiseTest.kt
│ └── wasmWasi/
│ └── src/
│ ├── Debug.kt
│ ├── EventLoop.kt
│ └── internal/
│ ├── CoroutineExceptionHandlerImpl.kt
│ └── CoroutineRunner.kt
├── kotlinx-coroutines-debug/
│ ├── README.md
│ ├── api/
│ │ └── kotlinx-coroutines-debug.api
│ ├── build.gradle.kts
│ ├── resources/
│ │ └── META-INF/
│ │ └── services/
│ │ └── reactor.blockhound.integration.BlockHoundIntegration
│ ├── src/
│ │ ├── Attach.kt
│ │ ├── CoroutineInfo.kt
│ │ ├── CoroutinesBlockHoundIntegration.kt
│ │ ├── DebugProbes.kt
│ │ ├── NoOpProbes.kt
│ │ ├── junit/
│ │ │ ├── CoroutinesTimeoutImpl.kt
│ │ │ ├── junit4/
│ │ │ │ ├── CoroutinesTimeout.kt
│ │ │ │ └── CoroutinesTimeoutStatement.kt
│ │ │ └── junit5/
│ │ │ ├── CoroutinesTimeout.kt
│ │ │ └── CoroutinesTimeoutExtension.kt
│ │ └── module-info.java
│ └── test/
│ ├── BlockHoundTest.kt
│ ├── CoroutinesDumpTest.kt
│ ├── DebugLeaksTest.kt
│ ├── DebugProbesTest.kt
│ ├── DebugTestBase.kt
│ ├── DumpCoroutineInfoAsJsonAndReferencesTest.kt
│ ├── DumpWithCreationStackTraceTest.kt
│ ├── EnhanceStackTraceWithTreadDumpAsJsonTest.kt
│ ├── Example.kt
│ ├── LazyCoroutineTest.kt
│ ├── RecoveryExample.kt
│ ├── RunningThreadStackMergeTest.kt
│ ├── SanitizedProbesTest.kt
│ ├── ScopedBuildersTest.kt
│ ├── StacktraceUtils.kt
│ ├── StandardBuildersDebugTest.kt
│ ├── StartModeProbesTest.kt
│ ├── TestRuleExample.kt
│ ├── ToStringTest.kt
│ ├── WithContextUndispatchedTest.kt
│ ├── junit4/
│ │ ├── CoroutinesTimeoutDisabledTracesTest.kt
│ │ ├── CoroutinesTimeoutEagerTest.kt
│ │ ├── CoroutinesTimeoutTest.kt
│ │ └── TestFailureValidation.kt
│ └── junit5/
│ ├── CoroutinesTimeoutExtensionTest.kt
│ ├── CoroutinesTimeoutInheritanceTest.kt
│ ├── CoroutinesTimeoutMethodTest.kt
│ ├── CoroutinesTimeoutNestedTest.kt
│ ├── CoroutinesTimeoutSimpleTest.kt
│ ├── CoroutinesTimeoutTest.kt
│ └── RegisterExtensionExample.kt
├── kotlinx-coroutines-test/
│ ├── MIGRATION.md
│ ├── README.md
│ ├── api/
│ │ ├── kotlinx-coroutines-test.api
│ │ └── kotlinx-coroutines-test.klib.api
│ ├── build.gradle.kts
│ ├── common/
│ │ ├── src/
│ │ │ ├── TestBuilders.kt
│ │ │ ├── TestCoroutineDispatchers.kt
│ │ │ ├── TestCoroutineScheduler.kt
│ │ │ ├── TestDispatcher.kt
│ │ │ ├── TestDispatchers.kt
│ │ │ ├── TestScope.kt
│ │ │ └── internal/
│ │ │ ├── ExceptionCollector.kt
│ │ │ ├── ReportingSupervisorJob.kt
│ │ │ └── TestMainDispatcher.kt
│ │ └── test/
│ │ ├── Helpers.kt
│ │ ├── RunTestTest.kt
│ │ ├── StandardTestDispatcherTest.kt
│ │ ├── TestCoroutineSchedulerTest.kt
│ │ ├── TestDispatchersTest.kt
│ │ ├── TestScopeTest.kt
│ │ └── UnconfinedTestDispatcherTest.kt
│ ├── js/
│ │ ├── src/
│ │ │ ├── TestBuilders.kt
│ │ │ └── internal/
│ │ │ ├── JsPromiseInterfaceForTesting.kt
│ │ │ └── TestMainDispatcher.kt
│ │ └── test/
│ │ ├── Helpers.kt
│ │ └── PromiseTest.kt
│ ├── jvm/
│ │ ├── resources/
│ │ │ └── META-INF/
│ │ │ ├── proguard/
│ │ │ │ └── coroutines.pro
│ │ │ └── services/
│ │ │ ├── kotlinx.coroutines.CoroutineExceptionHandler
│ │ │ └── kotlinx.coroutines.internal.MainDispatcherFactory
│ │ ├── src/
│ │ │ ├── TestBuildersJvm.kt
│ │ │ ├── internal/
│ │ │ │ └── TestMainDispatcherJvm.kt
│ │ │ ├── migration/
│ │ │ │ ├── TestBuildersDeprecated.kt
│ │ │ │ ├── TestCoroutineDispatcher.kt
│ │ │ │ ├── TestCoroutineExceptionHandler.kt
│ │ │ │ └── TestCoroutineScope.kt
│ │ │ └── module-info.java
│ │ └── test/
│ │ ├── DumpOnTimeoutTest.kt
│ │ ├── HelpersJvm.kt
│ │ ├── MemoryLeakTest.kt
│ │ ├── MultithreadingTest.kt
│ │ ├── RunTestStressTest.kt
│ │ ├── UncaughtExceptionsTest.kt
│ │ └── migration/
│ │ ├── RunBlockingTestOnTestScopeTest.kt
│ │ ├── RunTestLegacyScopeTest.kt
│ │ ├── TestBuildersTest.kt
│ │ ├── TestCoroutineDispatcherTest.kt
│ │ ├── TestCoroutineScopeTest.kt
│ │ ├── TestRunBlockingOrderTest.kt
│ │ └── TestRunBlockingTest.kt
│ ├── native/
│ │ ├── src/
│ │ │ ├── TestBuilders.kt
│ │ │ └── internal/
│ │ │ └── TestMainDispatcher.kt
│ │ └── test/
│ │ └── Helpers.kt
│ ├── npm/
│ │ ├── README.md
│ │ └── package.json
│ ├── wasmJs/
│ │ ├── src/
│ │ │ ├── TestBuilders.kt
│ │ │ └── internal/
│ │ │ ├── JsPromiseInterfaceForTesting.kt
│ │ │ └── TestMainDispatcher.kt
│ │ └── test/
│ │ ├── Helpers.kt
│ │ └── PromiseTest.kt
│ └── wasmWasi/
│ ├── src/
│ │ ├── TestBuilders.kt
│ │ └── internal/
│ │ └── TestMainDispatcher.kt
│ └── test/
│ └── Helpers.kt
├── license/
│ └── NOTICE.txt
├── reactive/
│ ├── README.md
│ ├── knit.properties
│ ├── knit.test.include
│ ├── kotlinx-coroutines-jdk9/
│ │ ├── README.md
│ │ ├── api/
│ │ │ └── kotlinx-coroutines-jdk9.api
│ │ ├── build.gradle.kts
│ │ ├── package.list
│ │ ├── src/
│ │ │ ├── Await.kt
│ │ │ ├── Publish.kt
│ │ │ ├── ReactiveFlow.kt
│ │ │ └── module-info.java
│ │ └── test/
│ │ ├── AwaitTest.kt
│ │ ├── FlowAsPublisherTest.kt
│ │ ├── IntegrationTest.kt
│ │ ├── PublishTest.kt
│ │ ├── PublisherAsFlowTest.kt
│ │ ├── PublisherBackpressureTest.kt
│ │ ├── PublisherCollectTest.kt
│ │ ├── PublisherCompletionStressTest.kt
│ │ └── PublisherMultiTest.kt
│ ├── kotlinx-coroutines-reactive/
│ │ ├── README.md
│ │ ├── api/
│ │ │ └── kotlinx-coroutines-reactive.api
│ │ ├── build.gradle.kts
│ │ ├── package.list
│ │ ├── src/
│ │ │ ├── Await.kt
│ │ │ ├── Channel.kt
│ │ │ ├── ContextInjector.kt
│ │ │ ├── Convert.kt
│ │ │ ├── Migration.kt
│ │ │ ├── Publish.kt
│ │ │ ├── ReactiveFlow.kt
│ │ │ └── module-info.java
│ │ └── test/
│ │ ├── AwaitCancellationStressTest.kt
│ │ ├── AwaitTest.kt
│ │ ├── CancelledParentAttachTest.kt
│ │ ├── FlowAsPublisherTest.kt
│ │ ├── IntegrationTest.kt
│ │ ├── IterableFlowTckTest.kt
│ │ ├── PublishTest.kt
│ │ ├── PublisherAsFlowTest.kt
│ │ ├── PublisherBackpressureTest.kt
│ │ ├── PublisherCollectTest.kt
│ │ ├── PublisherCompletionStressTest.kt
│ │ ├── PublisherMultiTest.kt
│ │ ├── PublisherRequestStressTest.kt
│ │ ├── PublisherSubscriptionSelectTest.kt
│ │ ├── RangePublisherBufferedTest.kt
│ │ ├── RangePublisherTest.kt
│ │ ├── ReactiveStreamTckTest.kt
│ │ └── UnboundedIntegerIncrementPublisherTest.kt
│ ├── kotlinx-coroutines-reactor/
│ │ ├── README.md
│ │ ├── api/
│ │ │ └── kotlinx-coroutines-reactor.api
│ │ ├── build.gradle.kts
│ │ ├── package.list
│ │ ├── resources/
│ │ │ └── META-INF/
│ │ │ └── services/
│ │ │ └── kotlinx.coroutines.reactive.ContextInjector
│ │ ├── src/
│ │ │ ├── Convert.kt
│ │ │ ├── Flux.kt
│ │ │ ├── Migration.kt
│ │ │ ├── Mono.kt
│ │ │ ├── ReactorContext.kt
│ │ │ ├── ReactorContextInjector.kt
│ │ │ ├── ReactorFlow.kt
│ │ │ ├── Scheduler.kt
│ │ │ └── module-info.java
│ │ └── test/
│ │ ├── BackpressureTest.kt
│ │ ├── Check.kt
│ │ ├── ConvertTest.kt
│ │ ├── FlowAsFluxTest.kt
│ │ ├── FluxCompletionStressTest.kt
│ │ ├── FluxContextTest.kt
│ │ ├── FluxMultiTest.kt
│ │ ├── FluxSingleTest.kt
│ │ ├── FluxTest.kt
│ │ ├── MonoAwaitStressTest.kt
│ │ ├── MonoTest.kt
│ │ ├── ReactorContextTest.kt
│ │ └── SchedulerTest.kt
│ ├── kotlinx-coroutines-rx2/
│ │ ├── README.md
│ │ ├── api/
│ │ │ └── kotlinx-coroutines-rx2.api
│ │ ├── build.gradle.kts
│ │ ├── package.list
│ │ ├── src/
│ │ │ ├── RxAwait.kt
│ │ │ ├── RxCancellable.kt
│ │ │ ├── RxChannel.kt
│ │ │ ├── RxCompletable.kt
│ │ │ ├── RxConvert.kt
│ │ │ ├── RxFlowable.kt
│ │ │ ├── RxMaybe.kt
│ │ │ ├── RxObservable.kt
│ │ │ ├── RxScheduler.kt
│ │ │ ├── RxSingle.kt
│ │ │ └── module-info.java
│ │ └── test/
│ │ ├── BackpressureTest.kt
│ │ ├── Check.kt
│ │ ├── CompletableTest.kt
│ │ ├── ConvertTest.kt
│ │ ├── FlowAsFlowableTest.kt
│ │ ├── FlowAsObservableTest.kt
│ │ ├── FlowableContextTest.kt
│ │ ├── FlowableExceptionHandlingTest.kt
│ │ ├── FlowableTest.kt
│ │ ├── IntegrationTest.kt
│ │ ├── IterableFlowAsFlowableTckTest.kt
│ │ ├── LeakedExceptionTest.kt
│ │ ├── MaybeTest.kt
│ │ ├── ObservableAsFlowTest.kt
│ │ ├── ObservableCollectTest.kt
│ │ ├── ObservableCompletionStressTest.kt
│ │ ├── ObservableExceptionHandlingTest.kt
│ │ ├── ObservableMultiTest.kt
│ │ ├── ObservableSingleTest.kt
│ │ ├── ObservableSourceAsFlowStressTest.kt
│ │ ├── ObservableSubscriptionSelectTest.kt
│ │ ├── ObservableTest.kt
│ │ ├── SchedulerStressTest.kt
│ │ ├── SchedulerTest.kt
│ │ └── SingleTest.kt
│ └── kotlinx-coroutines-rx3/
│ ├── README.md
│ ├── api/
│ │ └── kotlinx-coroutines-rx3.api
│ ├── build.gradle.kts
│ ├── package.list
│ ├── src/
│ │ ├── RxAwait.kt
│ │ ├── RxCancellable.kt
│ │ ├── RxChannel.kt
│ │ ├── RxCompletable.kt
│ │ ├── RxConvert.kt
│ │ ├── RxFlowable.kt
│ │ ├── RxMaybe.kt
│ │ ├── RxObservable.kt
│ │ ├── RxScheduler.kt
│ │ ├── RxSingle.kt
│ │ └── module-info.java
│ └── test/
│ ├── BackpressureTest.kt
│ ├── Check.kt
│ ├── CompletableTest.kt
│ ├── ConvertTest.kt
│ ├── FlowAsFlowableTest.kt
│ ├── FlowAsObservableTest.kt
│ ├── FlowableContextTest.kt
│ ├── FlowableExceptionHandlingTest.kt
│ ├── FlowableTest.kt
│ ├── IntegrationTest.kt
│ ├── IterableFlowAsFlowableTckTest.kt
│ ├── LeakedExceptionTest.kt
│ ├── MaybeTest.kt
│ ├── ObservableAsFlowTest.kt
│ ├── ObservableCollectTest.kt
│ ├── ObservableCompletionStressTest.kt
│ ├── ObservableExceptionHandlingTest.kt
│ ├── ObservableMultiTest.kt
│ ├── ObservableSingleTest.kt
│ ├── ObservableSourceAsFlowStressTest.kt
│ ├── ObservableSubscriptionSelectTest.kt
│ ├── ObservableTest.kt
│ ├── SchedulerStressTest.kt
│ ├── SchedulerTest.kt
│ └── SingleTest.kt
├── settings.gradle.kts
├── site/
│ └── stdlib.package.list
├── test-utils/
│ ├── build.gradle.kts
│ ├── common/
│ │ └── src/
│ │ ├── LaunchFlow.kt
│ │ ├── MainDispatcherTestBase.kt
│ │ └── TestBase.common.kt
│ ├── js/
│ │ └── src/
│ │ └── TestBase.kt
│ ├── jvm/
│ │ └── src/
│ │ ├── Exceptions.kt
│ │ ├── ExecutorRule.kt
│ │ ├── FieldWalker.kt
│ │ ├── TestBase.kt
│ │ └── Threads.kt
│ ├── native/
│ │ └── src/
│ │ └── TestBase.kt
│ ├── wasmJs/
│ │ └── src/
│ │ └── TestBase.kt
│ └── wasmWasi/
│ └── src/
│ └── TestBase.kt
└── ui/
├── README.md
├── coroutines-guide-ui.md
├── knit.code.include
├── knit.properties
├── kotlinx-coroutines-android/
│ ├── README.md
│ ├── android-unit-tests/
│ │ ├── build.gradle.kts
│ │ ├── resources/
│ │ │ └── META-INF/
│ │ │ └── services/
│ │ │ └── kotlinx.coroutines.CoroutineScope
│ │ ├── src/
│ │ │ └── EmptyCoroutineScopeImpl.kt
│ │ └── test/
│ │ └── ordered/
│ │ └── tests/
│ │ ├── CustomizedRobolectricTest.kt
│ │ ├── FirstMockedMainTest.kt
│ │ ├── FirstRobolectricTest.kt
│ │ ├── MockedMainTest.kt
│ │ ├── RobolectricTest.kt
│ │ └── TestComponent.kt
│ ├── api/
│ │ └── kotlinx-coroutines-android.api
│ ├── build.gradle.kts
│ ├── package.list
│ ├── resources/
│ │ └── META-INF/
│ │ ├── com.android.tools/
│ │ │ ├── proguard/
│ │ │ │ └── coroutines.pro
│ │ │ ├── r8-from-1.6.0/
│ │ │ │ └── coroutines.pro
│ │ │ └── r8-upto-3.0.0/
│ │ │ └── coroutines.pro
│ │ ├── proguard/
│ │ │ └── coroutines.pro
│ │ └── services/
│ │ ├── kotlinx.coroutines.CoroutineExceptionHandler
│ │ └── kotlinx.coroutines.internal.MainDispatcherFactory
│ ├── src/
│ │ ├── AndroidExceptionPreHandler.kt
│ │ ├── HandlerDispatcher.kt
│ │ └── module-info.java
│ ├── test/
│ │ ├── AndroidExceptionPreHandlerTest.kt
│ │ ├── DisabledHandlerTest.kt
│ │ ├── HandlerDispatcherAsyncTest.kt
│ │ ├── HandlerDispatcherTest.kt
│ │ └── R8ServiceLoaderOptimizationTest.kt
│ └── testdata/
│ ├── r8-test-common.pro
│ ├── r8-test-rules-no-optim.pro
│ └── r8-test-rules.pro
├── kotlinx-coroutines-javafx/
│ ├── README.md
│ ├── api/
│ │ └── kotlinx-coroutines-javafx.api
│ ├── build.gradle.kts
│ ├── resources/
│ │ └── META-INF/
│ │ └── services/
│ │ └── kotlinx.coroutines.internal.MainDispatcherFactory
│ ├── src/
│ │ ├── JavaFxConvert.kt
│ │ ├── JavaFxDispatcher.kt
│ │ └── module-info.java
│ └── test/
│ ├── JavaFxDispatcherTest.kt
│ ├── JavaFxObservableAsFlowTest.kt
│ ├── JavaFxStressTest.kt
│ ├── examples/
│ │ ├── FxAsFlow.kt
│ │ └── FxExampleApp.kt
│ └── guide/
│ ├── example-ui-actor-01.kt
│ ├── example-ui-actor-02.kt
│ ├── example-ui-actor-03.kt
│ ├── example-ui-advanced-01.kt
│ ├── example-ui-advanced-02.kt
│ ├── example-ui-basic-01.kt
│ ├── example-ui-basic-02.kt
│ ├── example-ui-basic-03.kt
│ ├── example-ui-blocking-01.kt
│ ├── example-ui-blocking-02.kt
│ └── example-ui-blocking-03.kt
└── kotlinx-coroutines-swing/
├── README.md
├── api/
│ └── kotlinx-coroutines-swing.api
├── build.gradle.kts
├── resources/
│ └── META-INF/
│ └── services/
│ └── kotlinx.coroutines.internal.MainDispatcherFactory
├── src/
│ ├── SwingDispatcher.kt
│ └── module-info.java
└── test/
├── SwingTest.kt
└── examples/
└── SwingExampleApp.kt
SYMBOL INDEX (42 symbols across 6 files)
FILE: benchmarks/scripts/generate_plots_flow_flatten_merge.py
function next_colour (line 22) | def next_colour():
function next_marker (line 28) | def next_marker():
function draw (line 34) | def draw(data, plt):
FILE: benchmarks/src/jmh/java/benchmarks/flow/scrabble/RxJava2PlaysScrabble.java
class RxJava2PlaysScrabble (line 20) | @Warmup(iterations = 7, time = 1, timeUnit = TimeUnit.SECONDS)
method play (line 28) | @Benchmark
FILE: benchmarks/src/jmh/java/benchmarks/flow/scrabble/RxJava2PlaysScrabbleOpt.java
class RxJava2PlaysScrabbleOpt (line 18) | @Warmup(iterations = 7, time = 1, timeUnit = TimeUnit.SECONDS)
method chars (line 25) | static Flowable<Integer> chars(String word) {
method play (line 30) | @Benchmark
FILE: benchmarks/src/jmh/java/benchmarks/flow/scrabble/optimizations/FlowableCharSequence.java
class FlowableCharSequence (line 10) | final class FlowableCharSequence extends Flowable<Integer> {
method FlowableCharSequence (line 14) | FlowableCharSequence(CharSequence string) {
method subscribeActual (line 18) | @Override
class CharSequenceSubscription (line 23) | static final class CharSequenceSubscription
method CharSequenceSubscription (line 38) | CharSequenceSubscription(Subscriber<? super Integer> downstream, Cha...
method cancel (line 44) | @Override
method request (line 49) | @Override
method fastPath (line 62) | void fastPath() {
method slowPath (line 80) | void slowPath(long r) {
method requestFusion (line 119) | @Override
method poll (line 124) | @Override
method isEmpty (line 134) | @Override
method clear (line 139) | @Override
FILE: benchmarks/src/jmh/java/benchmarks/flow/scrabble/optimizations/FlowableSplit.java
class FlowableSplit (line 20) | final class FlowableSplit extends Flowable<String> implements FlowableTr...
method FlowableSplit (line 28) | FlowableSplit(Publisher<String> source, Pattern pattern, int bufferSiz...
method apply (line 34) | @Override
method subscribeActual (line 39) | @Override
class SplitSubscriber (line 44) | static final class SplitSubscriber
method SplitSubscriber (line 81) | SplitSubscriber(Subscriber<? super String> downstream, Pattern patte...
method request (line 90) | @Override
method cancel (line 98) | @Override
method onSubscribe (line 109) | @Override
method onNext (line 120) | @Override
method tryOnNext (line 127) | @Override
method onError (line 158) | @Override
method onComplete (line 174) | @Override
method drain (line 187) | void drain() {
FILE: benchmarks/src/jmh/java/benchmarks/flow/scrabble/optimizations/StringFlowable.java
class StringFlowable (line 10) | public final class StringFlowable {
method StringFlowable (line 12) | private StringFlowable() {
method characters (line 21) | public static Flowable<Integer> characters(CharSequence string) {
method split (line 34) | public static FlowableTransformer<String, String> split(Pattern patter...
method split (line 47) | public static FlowableTransformer<String, String> split(Pattern patter...
method split (line 61) | public static FlowableTransformer<String, String> split(String pattern) {
method split (line 74) | public static FlowableTransformer<String, String> split(String pattern...
Condensed preview — 1270 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (5,417K chars).
[
{
"path": ".github/ISSUE_TEMPLATE/bug_report.md",
"chars": 1639,
"preview": "---\nname: Bug report\nabout: Our code behaves incorrectly?\ntitle: ''\nlabels: bug\nassignees: ''\n\n---\n\n<!--\n**Double-check*"
},
{
"path": ".github/ISSUE_TEMPLATE/config.yml",
"chars": 195,
"preview": "blank_issues_enabled: true\ncontact_links:\n - name: Kotlinlang Slack\n url: https://surveys.jetbrains.com/s3/kotlin-sl"
},
{
"path": ".github/ISSUE_TEMPLATE/design_considerations.md",
"chars": 1493,
"preview": "---\nname: Design considerations\nabout: We didn't think things through?\ntitle: ''\nlabels: design\nassignees: ''\n\n---\n\n<!--"
},
{
"path": ".github/ISSUE_TEMPLATE/feature_request.md",
"chars": 2228,
"preview": "---\nname: Feature request\nabout: We're missing something?\ntitle: ''\nlabels: enhancement\nassignees: ''\n\n---\n\n<!--\n**Doubl"
},
{
"path": ".github/ISSUE_TEMPLATE/guide.md",
"chars": 492,
"preview": "---\nname: Issue with the Coroutines guide\nabout: Problems on https://kotlinlang.org/docs/coroutines-guide.html\ntitle: ''"
},
{
"path": ".github/ISSUE_TEMPLATE/rc_feedback.md",
"chars": 781,
"preview": "---\nname: Release Candidate release feedback\nabout: Something used to work, but broke in an RC release?\ntitle: 'RC:'\nlab"
},
{
"path": ".gitignore",
"chars": 242,
"preview": "**/.idea/*\n!/.idea/icon.png\n!/.idea/vcs.xml\n!/.idea/copyright\n!/.idea/codeStyleSettings.xml\n!/.idea/codeStyles\n!/.idea/d"
},
{
"path": ".idea/codeStyleSettings.xml",
"chars": 210,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"ProjectCodeStyleSettingsManager\">\n <o"
},
{
"path": ".idea/codeStyles/Project.xml",
"chars": 628,
"preview": "<component name=\"ProjectCodeStyleConfiguration\">\n <code_scheme name=\"Project\" version=\"173\">\n <JetCodeStyleSettings>"
},
{
"path": ".idea/codeStyles/codeStyleConfig.xml",
"chars": 142,
"preview": "<component name=\"ProjectCodeStyleConfiguration\">\n <state>\n <option name=\"USE_PER_PROJECT_SETTINGS\" value=\"true\" />\n "
},
{
"path": ".idea/copyright/profiles_settings.xml",
"chars": 92,
"preview": "<component name=\"CopyrightManager\">\n <settings default=\"kotlinx.coroutines\" />\n</component>"
},
{
"path": ".idea/dictionaries/shared.xml",
"chars": 309,
"preview": "<component name=\"ProjectDictionaryState\">\n <dictionary name=\"shared\">\n <words>\n <w>Alistarh</w>\n <w>Elizar"
},
{
"path": ".idea/vcs.xml",
"chars": 840,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"CommitMessageInspectionProfile\">\n <pr"
},
{
"path": "CHANGES.md",
"chars": 18291,
"preview": "# Change log for kotlinx.coroutines\n\n## Version 1.10.2\n\n* Fixed the `kotlinx-coroutines-debug` JAR file including the `m"
},
{
"path": "CHANGES_UP_TO_1.7.md",
"chars": 112628,
"preview": "# Change log for kotlinx.coroutines\n\n## Version 1.7.0\n\n### Core API significant improvements\n\n* New `Channel` implementa"
},
{
"path": "CODE_OF_CONDUCT.md",
"chars": 269,
"preview": "## Code of Conduct\n\nThis project and the corresponding community is governed by the [JetBrains Open Source and Community"
},
{
"path": "CONTRIBUTING.md",
"chars": 5834,
"preview": "# Contributing Guidelines\n\nThere are two main ways to contribute to the project — submitting issues and submitting"
},
{
"path": "LICENSE.txt",
"chars": 11398,
"preview": "\n Apache License\n Version 2.0, January 2004\n "
},
{
"path": "README.md",
"chars": 16053,
"preview": "# kotlinx.coroutines \n\n[](https://kotlinlang.org/docs/components-stab"
},
{
"path": "RELEASE.md",
"chars": 3194,
"preview": "# kotlinx.coroutines release checklist\n\nTo release a new `<version>` of `kotlinx-coroutines`:\n\n1. Checkout the `develop`"
},
{
"path": "benchmarks/build.gradle.kts",
"chars": 1628,
"preview": "@file:Suppress(\"UnstableApiUsage\")\n\nimport org.jetbrains.kotlin.gradle.tasks.*\nimport org.jetbrains.kotlin.gradle.dsl.Jv"
},
{
"path": "benchmarks/scripts/generate_plots_flow_flatten_merge.py",
"chars": 3107,
"preview": "# To run this script run the command 'python3 scripts/generate_plots_flow_flatten_merge.py' in the /benchmarks folder\n\n\n"
},
{
"path": "benchmarks/src/jmh/java/benchmarks/flow/scrabble/RxJava2PlaysScrabble.java",
"chars": 6988,
"preview": "package benchmarks.flow.scrabble;\n\nimport benchmarks.flow.scrabble.IterableSpliterator;\nimport benchmarks.flow.scrabble."
},
{
"path": "benchmarks/src/jmh/java/benchmarks/flow/scrabble/RxJava2PlaysScrabbleOpt.java",
"chars": 7034,
"preview": "package benchmarks.flow.scrabble;\n\nimport java.util.*;\nimport java.util.Map.Entry;\nimport java.util.concurrent.TimeUnit;"
},
{
"path": "benchmarks/src/jmh/java/benchmarks/flow/scrabble/optimizations/FlowableCharSequence.java",
"chars": 3650,
"preview": "package benchmarks.flow.scrabble.optimizations;\n\nimport io.reactivex.Flowable;\nimport io.reactivex.internal.fuseable.Que"
},
{
"path": "benchmarks/src/jmh/java/benchmarks/flow/scrabble/optimizations/FlowableSplit.java",
"chars": 9219,
"preview": "package benchmarks.flow.scrabble.optimizations;\n\nimport io.reactivex.Flowable;\nimport io.reactivex.FlowableTransformer;\n"
},
{
"path": "benchmarks/src/jmh/java/benchmarks/flow/scrabble/optimizations/StringFlowable.java",
"chars": 2745,
"preview": "package benchmarks.flow.scrabble.optimizations;\n\nimport io.reactivex.Flowable;\nimport io.reactivex.FlowableTransformer;\n"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/ChannelSinkBenchmark.kt",
"chars": 2167,
"preview": "package benchmarks\n\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.channels.*\nimport org.openjdk.jmh.annotations."
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/ChannelSinkDepthBenchmark.kt",
"chars": 2524,
"preview": "package benchmarks\n\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.channels.*\nimport org.openjdk.jmh.annotations."
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/ChannelSinkNoAllocationsBenchmark.kt",
"chars": 904,
"preview": "package benchmarks\n\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.channels.*\nimport org.openjdk.jmh.annotations."
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/ParametrizedDispatcherBase.kt",
"chars": 1327,
"preview": "package benchmarks\n\nimport benchmarks.akka.CORES_COUNT\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.scheduling."
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/SequentialSemaphoreBenchmark.kt",
"chars": 967,
"preview": "package benchmarks\n\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.sync.*\nimport org.openjdk.jmh.annotations.*\nim"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/akka/PingPongAkkaBenchmark.kt",
"chars": 3615,
"preview": "package benchmarks.akka\n\nimport akka.actor.*\nimport com.typesafe.config.*\nimport org.openjdk.jmh.annotations.*\nimport sc"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/akka/StatefulActorAkkaBenchmark.kt",
"chars": 6343,
"preview": "package benchmarks.akka\n\nimport akka.actor.*\nimport com.typesafe.config.*\nimport org.openjdk.jmh.annotations.*\nimport sc"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/debug/DebugSequenceOverheadBenchmark.kt",
"chars": 2745,
"preview": "package benchmarks.debug\n\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.debug.*\nimport org.openjdk.jmh.annotatio"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/flow/CombineFlowsBenchmark.kt",
"chars": 831,
"preview": "package benchmarks.flow\n\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.flow.*\nimport org.openjdk.jmh.annotations"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/flow/CombineTwoFlowsBenchmark.kt",
"chars": 1302,
"preview": "package benchmarks.flow\n\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.flow.*\nimport kotlinx.coroutines.flow.int"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/flow/FlatMapMergeBenchmark.kt",
"chars": 1104,
"preview": "package benchmarks.flow\n\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.flow.*\nimport org.openjdk.jmh.annotations"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/flow/FlowFlattenMergeBenchmark.kt",
"chars": 1775,
"preview": "package benchmarks.flow\n\nimport benchmarks.common.*\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.flow.*\nimport "
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/flow/NumbersBenchmark.kt",
"chars": 3066,
"preview": "package benchmarks.flow\n\nimport benchmarks.flow.scrabble.flow\nimport io.reactivex.*\nimport io.reactivex.functions.*\nimpo"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/flow/SafeFlowBenchmark.kt",
"chars": 902,
"preview": "package benchmarks.flow\n\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.flow.*\nimport org.openjdk.jmh.annotations"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/flow/TakeBenchmark.kt",
"chars": 4265,
"preview": "package benchmarks.flow\n\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.flow.*\nimport org.openjdk.jmh.annotations"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/flow/scrabble/FlowPlaysScrabbleBase.kt",
"chars": 4562,
"preview": "package benchmarks.flow.scrabble\n\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.flow.*\nimport org.openjdk.jmh.an"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt.kt",
"chars": 5858,
"preview": "package benchmarks.flow.scrabble\n\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.flow.*\nimport kotlinx.coroutines"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/flow/scrabble/IterableSpliterator.kt",
"chars": 214,
"preview": "package benchmarks.flow.scrabble\n\nimport java.util.*\n\nobject IterableSpliterator {\n @JvmStatic\n public fun <T> of("
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/flow/scrabble/README.md",
"chars": 2681,
"preview": "## Reactive scrabble benchmarks\n\nThis package contains reactive scrabble benchmarks.\n\nReactive Scrabble benchmarks were "
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/flow/scrabble/ReactorPlaysScrabble.kt",
"chars": 5566,
"preview": "package benchmarks.flow.scrabble\n\nimport reactor.core.publisher.*\nimport java.lang.Long.*\nimport java.util.*\nimport java"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/flow/scrabble/SaneFlowPlaysScrabble.kt",
"chars": 3395,
"preview": "package benchmarks.flow.scrabble\n\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.flow.*\nimport org.openjdk.jmh.an"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/flow/scrabble/SequencePlaysScrabble.kt",
"chars": 3616,
"preview": "package benchmarks.flow.scrabble\n\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.flow.*\nimport org.openjdk.jmh.an"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/flow/scrabble/ShakespearePlaysScrabble.kt",
"chars": 2319,
"preview": "package benchmarks.flow.scrabble\n\nimport org.openjdk.jmh.annotations.*\nimport java.io.*\nimport java.util.stream.*\nimport"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/scheduler/DispatchersContextSwitchBenchmark.kt",
"chars": 1922,
"preview": "package benchmarks.scheduler\n\nimport benchmarks.akka.*\nimport kotlinx.coroutines.*\nimport org.openjdk.jmh.annotations.*\n"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/scheduler/ForkJoinBenchmark.kt",
"chars": 5843,
"preview": "package benchmarks.scheduler\n\nimport benchmarks.*\nimport kotlinx.coroutines.*\nimport org.openjdk.jmh.annotations.*\nimpor"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/scheduler/LaunchBenchmark.kt",
"chars": 1463,
"preview": "package benchmarks.scheduler\n\nimport benchmarks.*\nimport kotlinx.coroutines.*\nimport org.openjdk.jmh.annotations.*\nimpor"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/scheduler/StatefulAwaitsBenchmark.kt",
"chars": 5207,
"preview": "package benchmarks.scheduler\n\nimport benchmarks.*\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.channels.*\nimpor"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/scheduler/actors/ConcurrentStatefulActorBenchmark.kt",
"chars": 7487,
"preview": "package benchmarks.scheduler.actors\n\nimport benchmarks.*\nimport benchmarks.akka.*\nimport benchmarks.scheduler.actors.Sta"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/scheduler/actors/CycledActorsBenchmark.kt",
"chars": 4563,
"preview": "package benchmarks.scheduler.actors\n\nimport benchmarks.*\nimport benchmarks.akka.*\nimport benchmarks.scheduler.actors.Pin"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/scheduler/actors/PingPongActorBenchmark.kt",
"chars": 3870,
"preview": "package benchmarks.scheduler.actors\n\nimport benchmarks.*\nimport benchmarks.akka.*\nimport kotlinx.coroutines.*\nimport kot"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/scheduler/actors/PingPongWithBlockingContext.kt",
"chars": 1991,
"preview": "package benchmarks.scheduler.actors\n\nimport benchmarks.akka.*\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.chan"
},
{
"path": "benchmarks/src/jmh/kotlin/benchmarks/scheduler/actors/StatefulActorBenchmark.kt",
"chars": 4824,
"preview": "package benchmarks.scheduler.actors\n\nimport benchmarks.*\nimport benchmarks.akka.*\nimport kotlinx.coroutines.*\nimport kot"
},
{
"path": "benchmarks/src/main/kotlin/benchmarks/common/BenchmarkUtils.kt",
"chars": 460,
"preview": "package benchmarks.common\n\nimport java.util.concurrent.*\n\npublic fun doGeomDistrWork(work: Int) {\n // We use geometri"
},
{
"path": "build.gradle.kts",
"chars": 6017,
"preview": "import org.jetbrains.kotlin.config.KotlinCompilerVersion\nimport org.jetbrains.kotlin.gradle.dsl.*\nimport org.gradle.kotl"
},
{
"path": "buildSrc/build.gradle.kts",
"chars": 3014,
"preview": "import java.util.*\n\nplugins {\n `kotlin-dsl`\n}\n\nval cacheRedirectorEnabled = System.getenv(\"CACHE_REDIRECTOR\")?.toBool"
},
{
"path": "buildSrc/settings.gradle.kts",
"chars": 551,
"preview": "pluginManagement {\n val build_snapshot_train: String? by settings\n repositories {\n val cacheRedirectorEnabl"
},
{
"path": "buildSrc/src/main/kotlin/AuxBuildConfiguration.kt",
"chars": 2088,
"preview": "import CacheRedirector.configure\nimport org.gradle.api.Project\nimport org.gradle.api.tasks.*\nimport org.gradle.kotlin.ds"
},
{
"path": "buildSrc/src/main/kotlin/CacheRedirector.kt",
"chars": 5877,
"preview": "import org.gradle.api.*\nimport org.gradle.api.artifacts.dsl.*\nimport org.gradle.api.artifacts.repositories.*\nimport org."
},
{
"path": "buildSrc/src/main/kotlin/CommunityProjectsBuild.kt",
"chars": 6254,
"preview": "@file:JvmName(\"CommunityProjectsBuild\")\n\nimport org.gradle.api.*\nimport org.gradle.api.artifacts.dsl.*\nimport org.gradle"
},
{
"path": "buildSrc/src/main/kotlin/Dokka.kt",
"chars": 594,
"preview": "import org.gradle.api.*\nimport org.gradle.kotlin.dsl.*\nimport org.jetbrains.dokka.gradle.*\nimport java.io.*\nimport java."
},
{
"path": "buildSrc/src/main/kotlin/GlobalKotlinCompilerOptions.kt",
"chars": 611,
"preview": "import org.jetbrains.kotlin.gradle.dsl.KotlinCommonCompilerOptions\n\ninternal fun KotlinCommonCompilerOptions.configureGl"
},
{
"path": "buildSrc/src/main/kotlin/Idea.kt",
"chars": 129,
"preview": "object Idea {\n @JvmStatic // for Gradle\n val active: Boolean\n get() = System.getProperty(\"idea.active\") == "
},
{
"path": "buildSrc/src/main/kotlin/Java9Modularity.kt",
"chars": 6886,
"preview": "import org.gradle.api.*\nimport org.gradle.api.attributes.*\nimport org.gradle.api.file.*\nimport org.gradle.api.tasks.*\nim"
},
{
"path": "buildSrc/src/main/kotlin/Platform.kt",
"chars": 303,
"preview": "import org.gradle.api.Project\n\n// Use from Groovy for now\nfun platformOf(project: Project): String =\n when (project.n"
},
{
"path": "buildSrc/src/main/kotlin/Projects.kt",
"chars": 1699,
"preview": "@file:JvmName(\"Projects\")\n\nimport org.gradle.api.*\nimport org.gradle.api.tasks.*\n\nfun Project.version(target: String): S"
},
{
"path": "buildSrc/src/main/kotlin/Publishing.kt",
"chars": 9056,
"preview": "@file:Suppress(\"UnstableApiUsage\")\n\nimport groovy.util.Node\nimport groovy.util.NodeList\nimport org.gradle.api.Project\nim"
},
{
"path": "buildSrc/src/main/kotlin/SourceSets.kt",
"chars": 1900,
"preview": "import org.gradle.api.*\nimport org.jetbrains.kotlin.gradle.plugin.*\nimport org.gradle.kotlin.dsl.*\n\nfun KotlinSourceSet."
},
{
"path": "buildSrc/src/main/kotlin/UnpackAar.kt",
"chars": 2028,
"preview": "import org.gradle.api.*\nimport org.gradle.api.artifacts.transform.InputArtifact\nimport org.gradle.api.artifacts.transfor"
},
{
"path": "buildSrc/src/main/kotlin/VersionFile.kt",
"chars": 801,
"preview": "import org.gradle.api.*\nimport org.gradle.api.tasks.*\n\n/**\n * Adds 'module_name.version' file to the project's JAR META-"
},
{
"path": "buildSrc/src/main/kotlin/animalsniffer-jvm-conventions.gradle.kts",
"chars": 336,
"preview": "plugins {\n id(\"ru.vyarus.animalsniffer\")\n}\n\nproject.plugins.withType(JavaPlugin::class.java) {\n val signature: Con"
},
{
"path": "buildSrc/src/main/kotlin/animalsniffer-multiplatform-conventions.gradle.kts",
"chars": 362,
"preview": "plugins {\n id(\"ru.vyarus.animalsniffer\")\n}\n\nproject.plugins.withType(KotlinMultiplatformConventionsPlugin::class.java"
},
{
"path": "buildSrc/src/main/kotlin/bom-conventions.gradle.kts",
"chars": 534,
"preview": "import org.gradle.kotlin.dsl.*\nimport org.jetbrains.kotlin.gradle.dsl.*\n\n\nconfigure(subprojects.filter { it.name !in unp"
},
{
"path": "buildSrc/src/main/kotlin/configure-compilation-conventions.gradle.kts",
"chars": 1566,
"preview": "import org.jetbrains.kotlin.gradle.tasks.*\n\nconfigure(subprojects) {\n val project = this\n if (name in sourceless) "
},
{
"path": "buildSrc/src/main/kotlin/dokka-conventions.gradle.kts",
"chars": 3508,
"preview": "import org.jetbrains.dokka.gradle.*\nimport java.net.*\n\n\nplugins {\n id(\"org.jetbrains.dokka\")\n}\n\nval knit_version: Str"
},
{
"path": "buildSrc/src/main/kotlin/java-modularity-conventions.gradle.kts",
"chars": 621,
"preview": "// Currently the compilation of the module-info fails for\n// kotlinx-coroutines-play-services because it depends on Andr"
},
{
"path": "buildSrc/src/main/kotlin/knit-conventions.gradle.kts",
"chars": 590,
"preview": "plugins {\n id(\"kotlinx-knit\")\n}\n\nknit {\n siteRoot = \"https://kotlinlang.org/api/kotlinx.coroutines\"\n moduleRoot"
},
{
"path": "buildSrc/src/main/kotlin/kotlin-jvm-conventions.gradle.kts",
"chars": 979,
"preview": "// Platform-specific configuration to compile JVM modules\n\nimport org.gradle.api.*\nimport org.jetbrains.kotlin.gradle.ds"
},
{
"path": "buildSrc/src/main/kotlin/kotlin-multiplatform-conventions.gradle.kts",
"chars": 5166,
"preview": "import org.gradle.api.*\nimport org.gradle.api.tasks.testing.logging.*\nimport org.jetbrains.kotlin.gradle.dsl.*\n\nplugins "
},
{
"path": "buildSrc/src/main/kotlin/kover-conventions.gradle.kts",
"chars": 2567,
"preview": "import kotlinx.kover.gradle.plugin.dsl.*\n\nplugins {\n id(\"org.jetbrains.kotlinx.kover\")\n}\n\nval notCovered = sourceless"
},
{
"path": "buildSrc/src/main/kotlin/pub-conventions.gradle.kts",
"chars": 2366,
"preview": "import org.gradle.kotlin.dsl.*\n\n/*\n * For some absolutely cursed reason the name 'publication-conventions' doesn't work "
},
{
"path": "buildSrc/src/main/kotlin/source-set-conventions.gradle.kts",
"chars": 350,
"preview": "import org.jetbrains.kotlin.gradle.dsl.*\n\n// Redefine source sets because we are not using 'kotlin/main/fqn' folder conv"
},
{
"path": "buildSrc/src/main/kotlin/version-file-conventions.gradle.kts",
"chars": 444,
"preview": "import org.gradle.api.tasks.bundling.*\n\nconfigure(subprojects.filter { !unpublished.contains(it.name) && it.name !in sou"
},
{
"path": "bump-version.sh",
"chars": 2685,
"preview": "#!/bin/sh\n\nset -efu\n\n# the list of files that need to have the version updated in them\n#\n# limitations:\n# * no newlines "
},
{
"path": "coroutines-guide.md",
"chars": 294,
"preview": "The main coroutines guide has moved to the [docs folder](docs/topics/coroutines-guide.md) and split up into smaller docu"
},
{
"path": "docs/basics.md",
"chars": 253,
"preview": "The documentation has been moved to the [https://kotlinlang.org/docs/coroutines-basics.html](https://kotlinlang.org/docs"
},
{
"path": "docs/cancellation-and-timeouts.md",
"chars": 284,
"preview": "The documentation has been moved to the [https://kotlinlang.org/docs/cancellation-and-timeouts.html](https://kotlinlang."
},
{
"path": "docs/cfg/buildprofiles.xml",
"chars": 490,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<buildprofiles xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamesp"
},
{
"path": "docs/channels.md",
"chars": 216,
"preview": "The documentation has been moved to the [https://kotlinlang.org/docs/channels.html](https://kotlinlang.org/docs/channels"
},
{
"path": "docs/compatibility.md",
"chars": 91,
"preview": "The documentation has been moved to the [topics/compatibility.md](topics/compatibility.md)."
},
{
"path": "docs/composing-suspending-functions.md",
"chars": 304,
"preview": "The documentation has been moved to the [https://kotlinlang.org/docs/composing-suspending-functions.html](https://kotlin"
},
{
"path": "docs/coroutine-context-and-dispatchers.md",
"chars": 316,
"preview": "The documentation has been moved to the [https://kotlinlang.org/docs/coroutine-context-and-dispatchers.html](https://kot"
},
{
"path": "docs/coroutines-guide.md",
"chars": 248,
"preview": "The documentation has been moved to the [https://kotlinlang.org/docs/coroutines-guide.html](https://kotlinlang.org/docs/"
},
{
"path": "docs/debugging.md",
"chars": 83,
"preview": "The documentation has been moved to the [topics/debugging.md](topics/debugging.md)."
},
{
"path": "docs/exception-handling.md",
"chars": 256,
"preview": "The documentation has been moved to the [https://kotlinlang.org/docs/exception-handling.html](https://kotlinlang.org/doc"
},
{
"path": "docs/flow.md",
"chars": 200,
"preview": "The documentation has been moved to the [https://kotlinlang.org/docs/flow.html](https://kotlinlang.org/docs/flow.html) p"
},
{
"path": "docs/kc.tree",
"chars": 1025,
"preview": "<?xml version='1.0' encoding='utf-8'?>\n<!DOCTYPE instance-profile SYSTEM \"https://resources.jetbrains.com/writerside/1.0"
},
{
"path": "docs/knit.code.include",
"chars": 122,
"preview": "// This file was automatically generated from ${file.name} by Knit tool. Do not edit.\npackage ${knit.package}.${knit.nam"
},
{
"path": "docs/knit.test.template",
"chars": 606,
"preview": "// This file was automatically generated from ${file.name} by Knit tool. Do not edit.\npackage ${test.package}\n\nimport ko"
},
{
"path": "docs/select-expression.md",
"chars": 252,
"preview": "The documentation has been moved to the [https://kotlinlang.org/docs/select-expression.html](https://kotlinlang.org/docs"
},
{
"path": "docs/shared-mutable-state-and-concurrency.md",
"chars": 328,
"preview": "The documentation has been moved to the [https://kotlinlang.org/docs/shared-mutable-state-and-concurrency.html](https://"
},
{
"path": "docs/topics/cancellation-and-timeouts.md",
"chars": 25081,
"preview": "<contribute-url>https://github.com/Kotlin/kotlinx.coroutines/edit/master/docs/topics/</contribute-url>\n\n[//]: # (title: "
},
{
"path": "docs/topics/channels.md",
"chars": 22288,
"preview": "<!--- TEST_NAME ChannelsGuideTest -->\n<contribute-url>https://github.com/Kotlin/kotlinx.coroutines/edit/master/docs/topi"
},
{
"path": "docs/topics/compatibility.md",
"chars": 6488,
"preview": "<!--- TOC -->\n\n* [Compatibility](#compatibility)\n* [Public API types](#public-api-types)\n * [Experimental API](#experim"
},
{
"path": "docs/topics/composing-suspending-functions.md",
"chars": 14936,
"preview": "<!--- TEST_NAME ComposingGuideTest -->\n<contribute-url>https://github.com/Kotlin/kotlinx.coroutines/edit/master/docs/top"
},
{
"path": "docs/topics/coroutine-context-and-dispatchers.md",
"chars": 30076,
"preview": "<!--- TEST_NAME DispatcherGuideTest -->\n<contribute-url>https://github.com/Kotlin/kotlinx.coroutines/edit/master/docs/to"
},
{
"path": "docs/topics/coroutines-and-channels.md",
"chars": 67602,
"preview": "<contribute-url>https://github.com/Kotlin/kotlinx.coroutines/edit/master/docs/topics/</contribute-url>\n\n[//]: # (title: "
},
{
"path": "docs/topics/coroutines-basics.md",
"chars": 26175,
"preview": "<contribute-url>https://github.com/Kotlin/kotlinx.coroutines/edit/master/docs/topics/</contribute-url>\n\n[//]: # (title: "
},
{
"path": "docs/topics/coroutines-guide.md",
"chars": 2543,
"preview": "<contribute-url>https://github.com/Kotlin/kotlinx.coroutines/edit/master/docs/topics/</contribute-url>\n\n\n[//]: # (title:"
},
{
"path": "docs/topics/debug-coroutines-with-idea.md",
"chars": 5180,
"preview": "<contribute-url>https://github.com/Kotlin/kotlinx.coroutines/edit/master/docs/topics/</contribute-url>\n\n\n[//]: # (title:"
},
{
"path": "docs/topics/debug-flow-with-idea.md",
"chars": 6763,
"preview": "<contribute-url>https://github.com/Kotlin/kotlinx.coroutines/edit/master/docs/topics/</contribute-url>\n\n\n[//]: # (title:"
},
{
"path": "docs/topics/debugging.md",
"chars": 6382,
"preview": "**Table of contents**\n\n<!--- TOC -->\n\n* [Debugging coroutines](#debugging-coroutines)\n* [Debug mode](#debug-mode)\n* [Sta"
},
{
"path": "docs/topics/exception-handling.md",
"chars": 20661,
"preview": "<!--- TEST_NAME ExceptionsGuideTest -->\n<contribute-url>https://github.com/Kotlin/kotlinx.coroutines/edit/master/docs/to"
},
{
"path": "docs/topics/flow.md",
"chars": 64993,
"preview": "<!--- TEST_NAME FlowGuideTest --> \n<contribute-url>https://github.com/Kotlin/kotlinx.coroutines/edit/master/docs/topics/"
},
{
"path": "docs/topics/knit.properties",
"chars": 197,
"preview": "knit.package=kotlinx.coroutines.guide\nknit.dir=../../kotlinx-coroutines-core/jvm/test/guide/\n\ntest.package=kotlinx.corou"
},
{
"path": "docs/topics/select-expression.md",
"chars": 15934,
"preview": "<!--- TEST_NAME SelectGuideTest --> \n<contribute-url>https://github.com/Kotlin/kotlinx.coroutines/edit/master/docs/topic"
},
{
"path": "docs/topics/shared-mutable-state-and-concurrency.md",
"chars": 12567,
"preview": "<!--- TEST_NAME SharedStateGuideTest -->\n<contribute-url>https://github.com/Kotlin/kotlinx.coroutines/edit/master/docs/t"
},
{
"path": "docs/writerside.cfg",
"chars": 619,
"preview": "<?xml version='1.0' encoding='utf-8'?>\n<!DOCTYPE ihp SYSTEM \"https://resources.jetbrains.com/writerside/1.0/ihp.dtd\">\n<i"
},
{
"path": "dokka-templates/README.md",
"chars": 235,
"preview": "# Customize Dokka's HTML. \nTo customize Dokka's HTML output, place a file in this folder.\nDokka will find a template fil"
},
{
"path": "gradle/wrapper/gradle-wrapper.properties",
"chars": 338,
"preview": "distributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\ndistributionSha256Sum=fba8464465835e74f7270bbf43d6d8a8d"
},
{
"path": "gradle.properties",
"chars": 1351,
"preview": "# Kotlin\nversion=1.10.2-SNAPSHOT\ngroup=org.jetbrains.kotlinx\nkotlin_version=2.1.0\n# DO NOT rename this property without "
},
{
"path": "gradlew",
"chars": 8729,
"preview": "#!/bin/sh\n\n#\n# Copyright © 2015-2021 the original authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lice"
},
{
"path": "gradlew.bat",
"chars": 2966,
"preview": "@rem\r\n@rem Copyright 2015 the original author or authors.\r\n@rem\r\n@rem Licensed under the Apache License, Version 2.0 (th"
},
{
"path": "integration/README.md",
"chars": 719,
"preview": "# Coroutines integration\n\nThis directory contains modules that provide integration with various asynchronous callback- a"
},
{
"path": "integration/kotlinx-coroutines-guava/README.md",
"chars": 3533,
"preview": "# Module kotlinx-coroutines-guava\n\nIntegration with Guava [ListenableFuture](https://github.com/google/guava/wiki/Listen"
},
{
"path": "integration/kotlinx-coroutines-guava/api/kotlinx-coroutines-guava.api",
"chars": 933,
"preview": "public final class kotlinx/coroutines/guava/ListenableFutureKt {\n\tpublic static final fun asDeferred (Lcom/google/common"
},
{
"path": "integration/kotlinx-coroutines-guava/build.gradle.kts",
"chars": 314,
"preview": "val guavaVersion = \"31.0.1-jre\"\n\ndependencies {\n api(\"com.google.guava:guava:$guavaVersion\")\n}\n\njava {\n targetComp"
},
{
"path": "integration/kotlinx-coroutines-guava/package.list",
"chars": 402,
"preview": "com.google.common.annotations\ncom.google.common.base\ncom.google.common.cache\ncom.google.common.collect\ncom.google.common"
},
{
"path": "integration/kotlinx-coroutines-guava/src/ListenableFuture.kt",
"chars": 24292,
"preview": "package kotlinx.coroutines.guava\n\nimport com.google.common.util.concurrent.*\nimport com.google.common.util.concurrent.in"
},
{
"path": "integration/kotlinx-coroutines-guava/src/module-info.java",
"chars": 173,
"preview": "module kotlinx.coroutines.guava {\n requires kotlin.stdlib;\n requires kotlinx.coroutines.core;\n requires com.goo"
},
{
"path": "integration/kotlinx-coroutines-guava/test/FutureAsDeferredUnhandledCompletionExceptionTest.kt",
"chars": 1476,
"preview": "package kotlinx.coroutines.guava\n\nimport kotlinx.coroutines.testing.*\nimport com.google.common.util.concurrent.*\nimport "
},
{
"path": "integration/kotlinx-coroutines-guava/test/ListenableFutureExceptionsTest.kt",
"chars": 2368,
"preview": "package kotlinx.coroutines.guava\n\nimport kotlinx.coroutines.testing.*\nimport com.google.common.base.*\nimport com.google."
},
{
"path": "integration/kotlinx-coroutines-guava/test/ListenableFutureTest.kt",
"chars": 26600,
"preview": "package kotlinx.coroutines.guava\n\nimport kotlinx.coroutines.testing.*\nimport com.google.common.util.concurrent.*\nimport "
},
{
"path": "integration/kotlinx-coroutines-guava/test/ListenableFutureToStringTest.kt",
"chars": 2584,
"preview": "package kotlinx.coroutines.guava\n\nimport kotlinx.coroutines.testing.*\nimport kotlinx.coroutines.*\nimport org.junit.Test\n"
},
{
"path": "integration/kotlinx-coroutines-jdk8/README.md",
"chars": 103,
"preview": "# Stub module\n\nStub module for backwards compatibility. Since 1.7.0, this module was merged with core.\n"
},
{
"path": "integration/kotlinx-coroutines-jdk8/api/kotlinx-coroutines-jdk8.api",
"chars": 0,
"preview": ""
},
{
"path": "integration/kotlinx-coroutines-jdk8/build.gradle.kts",
"chars": 0,
"preview": ""
},
{
"path": "integration/kotlinx-coroutines-jdk8/src/module-info.java",
"chars": 73,
"preview": "@SuppressWarnings(\"JavaModuleNaming\")\nmodule kotlinx.coroutines.jdk8 {\n}\n"
},
{
"path": "integration/kotlinx-coroutines-play-services/README.md",
"chars": 1790,
"preview": "# Module kotlinx-coroutines-play-services\n\nIntegration with Google Play Services [Tasks API](https://developers.google.c"
},
{
"path": "integration/kotlinx-coroutines-play-services/api/kotlinx-coroutines-play-services.api",
"chars": 708,
"preview": "public final class kotlinx/coroutines/tasks/TasksKt {\n\tpublic static final fun asDeferred (Lcom/google/android/gms/tasks"
},
{
"path": "integration/kotlinx-coroutines-play-services/build.gradle.kts",
"chars": 447,
"preview": "val tasksVersion = \"16.0.1\"\n\nproject.configureAar()\n\ndependencies {\n configureAarUnpacking()\n api(\"com.google.andr"
},
{
"path": "integration/kotlinx-coroutines-play-services/package.list",
"chars": 28,
"preview": "com.google.android.gms.tasks"
},
{
"path": "integration/kotlinx-coroutines-play-services/src/Tasks.kt",
"chars": 5913,
"preview": "@file:Suppress(\"RedundantVisibilityModifier\")\n\npackage kotlinx.coroutines.tasks\n\nimport com.google.android.gms.tasks.*\ni"
},
{
"path": "integration/kotlinx-coroutines-play-services/test/FakeAndroid.kt",
"chars": 527,
"preview": "package android.os\n\nimport kotlinx.coroutines.GlobalScope\nimport kotlinx.coroutines.launch\nimport java.util.concurrent.*"
},
{
"path": "integration/kotlinx-coroutines-play-services/test/TaskTest.kt",
"chars": 13964,
"preview": "package kotlinx.coroutines.tasks\n\nimport kotlinx.coroutines.testing.*\nimport com.google.android.gms.tasks.*\nimport kotli"
},
{
"path": "integration/kotlinx-coroutines-slf4j/README.md",
"chars": 756,
"preview": "# Module kotlinx-coroutines-slf4j\n\nIntegration with SLF4J [MDC](https://logback.qos.ch/manual/mdc.html).\n\n## Example\n\nAd"
},
{
"path": "integration/kotlinx-coroutines-slf4j/api/kotlinx-coroutines-slf4j.api",
"chars": 911,
"preview": "public final class kotlinx/coroutines/slf4j/MDCContext : kotlin/coroutines/AbstractCoroutineContextElement, kotlinx/coro"
},
{
"path": "integration/kotlinx-coroutines-slf4j/build.gradle.kts",
"chars": 324,
"preview": "dependencies {\n implementation(\"org.slf4j:slf4j-api:1.7.32\")\n testImplementation(\"io.github.microutils:kotlin-logg"
},
{
"path": "integration/kotlinx-coroutines-slf4j/package.list",
"chars": 404,
"preview": "org.apache.commons.logging\norg.apache.commons.logging.impl\norg.apache.log4j\norg.apache.log4j.helpers\norg.apache.log4j.sp"
},
{
"path": "integration/kotlinx-coroutines-slf4j/src/MDCContext.kt",
"chars": 3207,
"preview": "package kotlinx.coroutines.slf4j\n\nimport kotlinx.coroutines.*\nimport org.slf4j.MDC\nimport kotlin.coroutines.AbstractCoro"
},
{
"path": "integration/kotlinx-coroutines-slf4j/src/module-info.java",
"chars": 165,
"preview": "module kotlinx.coroutines.slf4j {\n requires kotlin.stdlib;\n requires kotlinx.coroutines.core;\n requires org.slf"
},
{
"path": "integration/kotlinx-coroutines-slf4j/test/MDCContextTest.kt",
"chars": 3973,
"preview": "package kotlinx.coroutines.slf4j\n\nimport kotlinx.coroutines.testing.*\nimport kotlinx.coroutines.*\nimport org.junit.*\nimp"
},
{
"path": "integration/kotlinx-coroutines-slf4j/test-resources/logback-test.xml",
"chars": 348,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<configuration debug=\"false\">\n\n <appender name=\"CONSOLE\" class=\"ch.qos.logback"
},
{
"path": "integration-testing/.gitignore",
"chars": 23,
"preview": ".kotlin\nkotlin-js-store"
},
{
"path": "integration-testing/README.md",
"chars": 1198,
"preview": "# Integration tests\n\nThis is a supplementary project that provides integration tests.\n\nThe tests are the following:\n* `m"
},
{
"path": "integration-testing/build.gradle.kts",
"chars": 7962,
"preview": "import org.jetbrains.kotlin.gradle.dsl.JvmTarget\nimport org.jetbrains.kotlin.gradle.tasks.KotlinCompile\nimport org.jetbr"
},
{
"path": "integration-testing/gradle/wrapper/gradle-wrapper.properties",
"chars": 250,
"preview": "distributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributi"
},
{
"path": "integration-testing/gradle.properties",
"chars": 154,
"preview": "kotlin_version=2.1.0\ncoroutines_version=1.10.2-SNAPSHOT\nasm_version=9.3\njunit5_version=5.7.0\n\nkotlin.code.style=official"
},
{
"path": "integration-testing/gradlew",
"chars": 8739,
"preview": "#!/bin/sh\n\n#\n# Copyright © 2015-2021 the original authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lice"
},
{
"path": "integration-testing/gradlew.bat",
"chars": 2872,
"preview": "@rem\n@rem Copyright 2015 the original author or authors.\n@rem\n@rem Licensed under the Apache License, Version 2.0 (the \""
},
{
"path": "integration-testing/java8Test/build.gradle.kts",
"chars": 607,
"preview": "plugins {\n kotlin(\"jvm\")\n}\n\nrepositories {\n mavenCentral()\n maven(\"https://maven.pkg.jetbrains.space/kotlin/p/k"
},
{
"path": "integration-testing/java8Test/src/test/kotlin/JUnit5TimeoutCompilation.kt",
"chars": 213,
"preview": "import kotlinx.coroutines.debug.junit5.CoroutinesTimeout\nimport org.junit.jupiter.api.*\n\nclass JUnit5TimeoutCompilation "
},
{
"path": "integration-testing/jpmsTest/build.gradle.kts",
"chars": 1104,
"preview": "@file:Suppress(\"PropertyName\")\nplugins {\n kotlin(\"jvm\")\n}\n\nval coroutines_version: String by project\n\nrepositories {\n"
},
{
"path": "integration-testing/jpmsTest/src/debugDynamicAgentJpmsTest/java/module-info.java",
"chars": 191,
"preview": "module debug.dynamic.agent.jpms.test {\n requires kotlin.stdlib;\n requires kotlinx.coroutines.core;\n requires ko"
},
{
"path": "integration-testing/jpmsTest/src/debugDynamicAgentJpmsTest/kotlin/DynamicAttachDebugJpmsTest.kt",
"chars": 1913,
"preview": "@file:OptIn(ExperimentalCoroutinesApi::class)\n\nimport org.junit.*\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines."
},
{
"path": "integration-testing/settings.gradle.kts",
"chars": 334,
"preview": "pluginManagement {\n repositories {\n mavenCentral()\n maven(\"https://plugins.gradle.org/m2/\")\n mav"
},
{
"path": "integration-testing/smokeTest/build.gradle.kts",
"chars": 2814,
"preview": "import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl\nimport org.jetbrains.kotlin.gradle.dsl.HasConfigurableKotlinCompi"
},
{
"path": "integration-testing/smokeTest/src/commonMain/kotlin/Sample.kt",
"chars": 159,
"preview": "import kotlinx.coroutines.*\n\nsuspend fun doWorld() = coroutineScope {\n launch {\n delay(1000L)\n println("
},
{
"path": "integration-testing/smokeTest/src/commonTest/kotlin/SampleTest.kt",
"chars": 137,
"preview": "import kotlinx.coroutines.test.*\nimport kotlin.test.*\n\nclass SampleTest {\n @Test\n fun test() = runTest {\n d"
},
{
"path": "integration-testing/src/coreAgentTest/kotlin/CoreAgentTest.kt",
"chars": 589,
"preview": "import org.junit.*\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.debug.internal.*\nimport org.junit.Test\nimport j"
},
{
"path": "integration-testing/src/debugAgentTest/kotlin/DebugAgentTest.kt",
"chars": 563,
"preview": "@file:OptIn(ExperimentalCoroutinesApi::class)\n\nimport org.junit.*\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines."
},
{
"path": "integration-testing/src/debugAgentTest/kotlin/DebugProbes.kt",
"chars": 524,
"preview": "@file:Suppress(\"INVISIBLE_MEMBER\", \"INVISIBLE_REFERENCE\")\npackage kotlin.coroutines.jvm.internal\n\nimport kotlinx.corouti"
},
{
"path": "integration-testing/src/debugAgentTest/kotlin/PrecompiledDebugProbesTest.kt",
"chars": 1986,
"preview": "import org.junit.Test\nimport java.io.*\nimport kotlin.test.*\n\n/*\n * This is intentionally put here instead of coreAgentTe"
},
{
"path": "integration-testing/src/debugDynamicAgentTest/kotlin/DynamicAttachDebugTest.kt",
"chars": 837,
"preview": "import org.junit.*\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.debug.*\nimport org.junit.Test\nimport java.io.*\n"
},
{
"path": "integration-testing/src/jvmCoreTest/kotlin/Jdk8InCoreIntegration.kt",
"chars": 492,
"preview": "package kotlinx.coroutines\n\nimport kotlinx.coroutines.future.*\nimport org.junit.Test\nimport kotlin.test.*\n\n/*\n * Integra"
},
{
"path": "integration-testing/src/jvmCoreTest/kotlin/ListAllCoroutineThrowableSubclassesTest.kt",
"chars": 2501,
"preview": "package kotlinx.coroutines\n\nimport com.google.common.reflect.*\nimport kotlinx.coroutines.*\nimport org.junit.Test\nimport "
},
{
"path": "integration-testing/src/mavenTest/kotlin/MavenPublicationAtomicfuValidator.kt",
"chars": 2839,
"preview": "package kotlinx.coroutines.validator\n\nimport org.junit.Test\nimport org.objectweb.asm.*\nimport org.objectweb.asm.ClassRea"
},
{
"path": "integration-testing/src/mavenTest/kotlin/MavenPublicationMetaInfValidator.kt",
"chars": 2353,
"preview": "package kotlinx.coroutines.validator\n\nimport org.junit.Test\nimport org.objectweb.asm.*\nimport org.objectweb.asm.ClassRea"
},
{
"path": "integration-testing/src/mavenTest/kotlin/MavenPublicationVersionValidator.kt",
"chars": 1098,
"preview": "package kotlinx.coroutines.validator\n\nimport org.junit.Test\nimport java.util.jar.*\nimport kotlin.test.*\n\nclass MavenPubl"
},
{
"path": "knit.properties",
"chars": 503,
"preview": "knit.include=docs/knit.code.include\ntest.template=docs/knit.test.template\n\n# Various test validation modes and their cor"
},
{
"path": "kotlinx-coroutines-bom/build.gradle.kts",
"chars": 2075,
"preview": "import org.gradle.api.publish.maven.internal.publication.DefaultMavenPublication\nimport java.util.Locale\n\nplugins {\n "
},
{
"path": "kotlinx-coroutines-core/README.md",
"chars": 19597,
"preview": "# Module kotlinx-coroutines-core\n\nCore primitives to work with coroutines.\n\nCoroutine builder functions:\n\n| **Name** "
},
{
"path": "kotlinx-coroutines-core/api/kotlinx-coroutines-core.api",
"chars": 109993,
"preview": "public abstract class kotlinx/coroutines/AbstractCoroutine : kotlinx/coroutines/JobSupport, kotlin/coroutines/Continuati"
},
{
"path": "kotlinx-coroutines-core/api/kotlinx-coroutines-core.klib.api",
"chars": 186318,
"preview": "// Klib ABI Dump\n// Targets: [androidNativeArm32, androidNativeArm64, androidNativeX64, androidNativeX86, iosArm64, iosS"
},
{
"path": "kotlinx-coroutines-core/benchmarks/README.md",
"chars": 782,
"preview": "## kotlinx-coroutines-core benchmarks\n\nMultiplatform benchmarks for kotlinx-coroutines-core.\n\nThis source-set contains b"
},
{
"path": "kotlinx-coroutines-core/benchmarks/jvm/kotlin/kotlinx/coroutines/BenchmarkUtils.kt",
"chars": 461,
"preview": "package kotlinx.coroutines\n\nimport java.util.concurrent.*\n\npublic fun doGeomDistrWork(work: Int) {\n // We use geometr"
},
{
"path": "kotlinx-coroutines-core/benchmarks/jvm/kotlin/kotlinx/coroutines/SemaphoreBenchmark.kt",
"chars": 2799,
"preview": "package kotlinx.coroutines\n\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.channels.*\nimport kotlinx.coroutines.s"
},
{
"path": "kotlinx-coroutines-core/benchmarks/jvm/kotlin/kotlinx/coroutines/channels/ChannelProducerConsumerBenchmark.kt",
"chars": 4869,
"preview": "package kotlinx.coroutines.channels\n\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.channels.Channel\nimport kotli"
},
{
"path": "kotlinx-coroutines-core/benchmarks/jvm/kotlin/kotlinx/coroutines/channels/SelectBenchmark.kt",
"chars": 950,
"preview": "package kotlinx.coroutines.channels\n\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.channels.*\nimport kotlinx.cor"
},
{
"path": "kotlinx-coroutines-core/benchmarks/jvm/kotlin/kotlinx/coroutines/channels/SimpleChannel.kt",
"chars": 2444,
"preview": "package kotlinx.coroutines.channels\n\nimport kotlinx.coroutines.*\nimport kotlin.coroutines.*\nimport kotlin.coroutines.int"
},
{
"path": "kotlinx-coroutines-core/benchmarks/jvm/kotlin/kotlinx/coroutines/channels/SimpleChannelBenchmark.kt",
"chars": 1312,
"preview": "package kotlinx.coroutines.channels\n\nimport kotlinx.coroutines.*\nimport org.openjdk.jmh.annotations.*\nimport java.util.c"
},
{
"path": "kotlinx-coroutines-core/benchmarks/jvm/kotlin/kotlinx/coroutines/flow/TakeWhileBenchmark.kt",
"chars": 2093,
"preview": "package kotlinx.coroutines.flow\n\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.flow.internal.*\nimport kotlinx.co"
},
{
"path": "kotlinx-coroutines-core/benchmarks/main/kotlin/SharedFlowBaseline.kt",
"chars": 641,
"preview": "package kotlinx.coroutines\n\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.flow.*\nimport kotlinx.benchmark.*\n\n// "
},
{
"path": "kotlinx-coroutines-core/build.gradle.kts",
"chars": 12019,
"preview": "import org.gradle.api.tasks.testing.*\nimport org.gradle.kotlin.dsl.*\nimport org.gradle.kotlin.dsl.withType\nimport org.je"
}
]
// ... and 1070 more files (download for full content)
About this extraction
This page contains the full source code of the Kotlin/kotlinx.coroutines GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 1270 files (4.9 MB), approximately 1.4M tokens, and a symbol index with 42 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.