Promote CoroutineStart.UNDISPATCHED to non experimental API
See original GitHub issueI use it quite often in places where I know it’s safe to use, with the following import alias:
import kotlinx.coroutines.CoroutineStart.UNDISPATCHED as Undispatched
It’d be great to not have to have to add @UseExperimental(ExperimentalCoroutinesApi::class)
to each usage.
I’m interested to know of any considerations that could justify leaving it experimental, postponing that decision or replacing it with something else (like a startDispatched: Boolean = true
parameter).
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
CoroutineStart.UNDISPATCHED - kotlinx-coroutines-core
Immediately executes coroutine until its first suspension point in the current thread as if it the coroutine was started using Unconfined dispatcher.
Read more >Promote CoroutineStart.UNDISPATCHED to non experimental API ...
I'm interested to know of any considerations that could justify leaving it experimental, postponing that decision or replacing it with something else (like...
Read more >FlowPreview - Kotlin
According to the feedback, Flow will be refined on its road to stabilization and promotion to a stable API. The best way to...
Read more >Change log for kotlinx.coroutines - GitHub
`@ExperimentalTime` is no longer needed for methods that use `Duration` (#3041). ... UNDISPATCHED` promoted to stable API (#1393) * Kotlin updated to 1.4.30 ......
Read more >WhatsNew 2.0 | Ktor Framework
Kotlin Server and Client Framework for microservices, HTTP APIs, and RESTful services. ... WebSocketDeflateExtension not following RFC.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Note:
We’ve discussed internally and decided that the difference between
Dispatchers.Unconfined
andCoroutineStart.UNDISPATCHED
(the latter does not form an event loop) is expected and advanced users (that know when they needUNDISPATCHED
) know the difference and won’t be surprised.We run into cases where we often want to initiate a concurrent process from a non-suspending context and ensure that we’ve run to a first suspension point to await incoming work. In compose this most recently has come up when we need to start a Recomposer before synchronously creating new compositions bound to it; if we can start the recomposition loop undispatched, we know we have not failed to observe any snapshot state invalidations that happened in between initial composition and the recomposition loop and associated snapshot observation beginning. Missing this window due to dispatch can mean we perform some initial composition work twice.
The shape of the use case reduces to something analogous to: