kotlinx.coroutines
kotlinx.coroutines copied to clipboard
Library support for Kotlin coroutines
**Use case** [`runInterruptible`](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/run-interruptible.html) allows one to run blocking Java code and interrupt it when the coroutine it's running in gets cancelled. Internally, this is implemented by reacting to notifications about...
**Use case** 1. I have a data source that can only be subscribed to once per process (specifically, [this](https://developer.android.com/reference/kotlin/androidx/health/services/client/PassiveMonitoringClient#setPassiveListenerCallback(androidx.health.services.client.data.PassiveListenerConfig,androidx.health.services.client.PassiveListenerCallback)) one - note that `set...Callback` rather than `add...Callback`). 2. On subscription,...
As mentioned in https://github.com/Kotlin/kotlinx.coroutines/blob/master/ui/kotlinx-coroutines-android/README.md#optimization > When optimizations are enabled with R8 version 1.6.0 or later the following debugging features are permanently turned off to reduce the size of the resulting...
**Describe the bug** The following test works on Android, but crashes on iOS: ``` @Test fun reproduce() = runBlocking { val dispatcher = newSingleThreadContext("MyDispatcher") launch(dispatcher) { try { withContext(Dispatchers.Default) {...
## Description It seems that when using `runTest` with `UnconfinedTestDispatcher`, when code inside the test wraps the dispatcher with a `ContinuationInterceptor` that delegates to the dispatcher, `advanceUntilIdle` will not wait...
I've got some code using `callbackFlow` with `buffer(Channel.RENDEZVOUS)`. There's a deadlock elsewhere in my code that I believe is triggered by something in my `awaitClose` block not completing. Introducing an...
Since the `onCompletion` argument of `produce` is marked with `InternalCoroutinesApi`, the reason why it was introduced (#279) is back on the table. In short: if a resource is open before...
The difference between `coroutineScope` and `supervisorScope` can be narrowed down to the strategy of dealing with children exceptions. When a child coroutine fails with exception, it can be either _propagated_...
The Flow retry/retryWhen `attempt` counter never resets; it provides a kind of flow flakiness measure rather than the number of retry attempts after the last failure. This behavior is not...
Hi, I am/was quite struggling how is propagated cancelling to children/parent scopes. Commenting on [Cancellation and timeouts](https://github.com/Kotlin/kotlinx.coroutines/blob/master/docs/cancellation-and-timeouts.md). 1) if the "execution" is paused on the `await` call, I was not...