kotlinx.coroutines
kotlinx.coroutines copied to clipboard
Library support for Kotlin coroutines
This test due to the flaky code: ```kotlin @Test fun `CoroutineStart_UNDISPATCHED is flaky when using collectLatest`() = repeat(10) { runBlocking(Dispatchers.IO) { println("Iteration $it") val flow = MutableSharedFlow(extraBufferCapacity = 1, onBufferOverflow...
Failure: https://teamcity.jetbrains.com/buildConfiguration/KotlinTools_KotlinxCoroutines_Build/5116130 Stacktrace: ``` java.lang.AssertionError: Coroutine stacktrace headers are not matched: - Coroutine "coroutine":DeferredCoroutine{Active}@1e4a7dd4, state: SUSPENDED + Coroutine "coroutine":DeferredCoroutine{Active}@16ffbe93, state: RUNNING (Last suspension stacktrace, not an actual stacktrace) expected: but...
**Use case** I am creating Kotlin/Native bindings for GTK and need to set a custom `CoroutineDispatcher` as the main dispatcher. This is essential because GTK operates with its own main...
Hello, I'm trying to solve a problem perfectly with the help of `channelFlow { … }`, but `send(…)`'s unavoidable prompt-cancellation guarantee is getting in the way. **Use case:** In the...
**Describe the bug** In IntelliJ, we observe a performance degradation connected to #4255 . It seems that previously skipped `tryUnpark` starts to be visible in performance snapshots. **Provide a Reproducer**...
Two previous examples (L63-84) could be misinterpreted as if there's a need to explicitly `join` or generally wait for children coroutines to finish, since they don't do anything after joining...
This example illustrating when `send` suspends works on a single-threaded dispatcher, but is `send` guaranteed to suspend on a multithreaded dispatcher? ``` val channel = Channel() launch { check(channel.receive() ==...
Open questions are: - [x] The proper module name. Perhaps, `kotlinx.coroutines.core.metadata` will be better. - [ ] Should we continue suggesting to use `kotlinx-coroutines-core` dependency in the readme file? I...
Originally reported by Uli Luckas in the Kotlinlang Slack: https://kotlinlang.slack.com/archives/C1CFAFJSK/p1742815571506039?thread_ts=1742814326.569149&cid=C1CFAFJSK The caveat with how `withContext` may drop closeable resources (https://github.com/Kotlin/kotlinx.coroutines/issues/3504) should be highlighted in the guide: ```kotlin val socket =...
When writing an advanced test that uses multiple related `TestCoroutineDispatcher` instances, there is a problem that can occur when one dispatches a task to another: ``` val dispatcherA = TestCoroutineDispatcher()...