kotlinx.coroutines
kotlinx.coroutines copied to clipboard
Library support for Kotlin coroutines
This enhancement request comes from the Spring Framework team with https://github.com/spring-projects/spring-framework/issues/32165 as background. **Use case** Right now, the `kotlinx-coroutines-reactor` library copies the Reactor context as a key under the Coroutine...
**What do we have now?** ```kotlin import kotlinx.coroutines.* fun main() { runBlocking { launch(Dispatchers.Unconfined) { println("Starting in ${Thread.currentThread()}") delay(100) println("Continuing in ${Thread.currentThread()}") } } } ``` currently outputs ``` Starting...
* [ ] Revisit documentation, explicitly spell out the purpose of the API, samplify * [ ] Mark it as delicate API * [ ] Short-cut it if necessary (#3259)...
I won't encounter this issue when using version 1.8.1 ` @Test fun concurrentExecution1() = runTest { println("当前线程=${Thread.currentThread().name}") val queue = ArrayBlockingQueue(150) val scope = CoroutineScope(testScheduler) for (index in 1..150) {...
`CoroutineScope.newCoroutineContext` currently sets up coroutine contexts via a hard-wired mechanism: https://github.com/Kotlin/kotlinx.coroutines/blob/287a931d3b8ce534757c6c2399eb72e6574bcf69/kotlinx-coroutines-core/jvm/src/CoroutineContext.kt#L32-L37 Here is a use case where a customizable set of default context elements would help: The Kotest assertions library...
I need to create a complex actor using some private methods to update the internal state, but I cannot find any useful base class to implement `ActorJob`. What is the...
**Describe the bug** `yield()` introduces special behavior for optimization: instead of calling `dispatch`, it calls a specialized `dispatchYield` function. In theory, that function allows for some optimization: we know we're...
Fixes KT-72051 for coroutines
https://youtrack.jetbrains.com/issue/IDEA-359879/coroutines-debugging-Investigate-split-package-problem https://github.com/Kotlin/kotlinx.coroutines/issues/4124
There are happens-before guarantees for executing the same coroutine even when it changes threads: https://proandroiddev.com/what-is-concurrent-access-to-mutable-state-f386e5cb8292 We occasionally get asked about this, and https://kotlinlang.org/docs/shared-mutable-state-and-concurrency.html has no mention of happens-before.