kotlinx.coroutines
kotlinx.coroutines copied to clipboard
Library support for Kotlin coroutines
This is a subtask required for #3886 Work outline: * [x] Get rid of DCSS (double compare single swap) primitive in `JobSupport` state transitions * [ ] Prototype the solution...
**Use case** I read BLE characteristics and send them throught a Flow for the rest of my application to act on it. The BLE characteristics are based on real world...
We have `LockFreeLinkedListNode` and co. based on the ["Lock-Free and Practical Doubly Linked List-Based Deques Using Single-Word Compare-and-Swap"](https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.140.4693&rep=rep1&type=pdf) paper. The implementation has a long-standing tail of issues: 1. The paper...
Usage would look like so: ```kotlin someFlow.launchIn(lifecycleScope, start = CoroutineStart.UNDISPATCHED) ``` My current use-case is to have the UI be set up synchronously by the flow collection start, avoiding an...
The following example hangs forever: ```kotlin class LazyChildTest : CoroutineScope { @get:Rule val timeout: CoroutinesTimeout = CoroutinesTimeout.seconds(1) private val parent = Job() override val coroutineContext: CoroutineContext = parent @BeforeTest fun...
We already have a notion of debug mode in our documentation, but we do not have an API to check whether the mode is enabled. It can be useful in...
It is inconvenient to use `suspendCancellableCoroutine` to wrap an API that requires a callback to be unregistered after receiving the call. Examples include "event bus" or "broadcast" APIs which do...
If `withTimeout` wraps a blocking job, it does not detect a timeout in conjunction with `newSingleThreadContext()`. Timeout detection works as expected with other dispatcher flavors: ```kotlin import kotlinx.coroutines.* // ktlint-disable...
**Use case** I have some data, which is represented as flow of updates. And I need to calculate SateFlow of some derived data, which is essentially can be thought as...
Consider https://pl.kotl.in/g6pikDNtt: ``` val topFlow = flow { emit(1) delay(100L) emit(2) emit(3) delay(300L) emit(4) } val bottomFlow = flow { topFlow .onEach { emit(it) } .sample(periodMillis = 200) .collect {...