kotlinx.coroutines
kotlinx.coroutines copied to clipboard
Library support for Kotlin coroutines
`coroutines-guide-ui.md` uses GlobalScope for scope in it's examples, e.g. in section [At most one current job](https://github.com/Kotlin/kotlinx.coroutines/blob/master/ui/coroutines-guide-ui.md#at-most-one-concurrent-job): ``` fun View.onClick(action: suspend (View) -> Unit) { // launch one actor val eventActor...
The "Extract function refactoring" section in the documentation (link [on the website](https://kotlinlang.org/docs/reference/coroutines/basics.html#extract-function-refactoring) and [in the repo](https://github.com/Kotlin/kotlinx.coroutines/blob/d55d8e80e152e46c170edc4dcfa08ccb7b2c4a03/docs/basics.md#extract-function-refactoring)) describes the process of extracting out a suspend function and makes a couple statements...
There is a section in coroutines guide "Shared mutable state and concurrency". Inside there is a statement, that accessing shared mutable state from multiple coroutines executed in a multithreaded Dispatcher...
[`SharedFlow`](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-shared-flow/index.html), [`StateFlow`](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-state-flow/index.html), and their mutable counterparts have good KDoc, but they're conspicuously absent from the main https://kotlinlang.org/docs/ site. This may limit their discoverability and use. `Flow` is covered (https://kotlinlang.org/docs/flow.html), but...
**Describe the bug** The time source or the underlaying `currentTime` is not updated after switching the context to a non delay skipping dispatcher. Our use-case: Ktor We want to change...
**Use case** In IJ we log coroutine dumps, here's an example subtree: ``` - "com.intellij.openapi.fileEditor.impl.PsiAwareFileEditorManagerImpl":StandaloneCoroutine{Active}, state: SUSPENDED [ComponentManager(ProjectImpl@1365006477), Dispatchers.Default] at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:36) at kotlinx.coroutines.flow.internal.ChannelFlow$collect$2.invokeSuspend(ChannelFlow.kt:123) at kotlinx.coroutines.flow.FlowKt__ShareKt$launchSharing$1.invokeSuspend(Share.kt:214) - "com.intellij.openapi.fileEditor.impl.PsiAwareFileEditorManagerImpl":ProducerCoroutine{Active}, state: SUSPENDED [ComponentManager(ProjectImpl@1365006477),...
MutableSharedFlow [**function**](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-mutable-shared-flow.html) has three parameters: - replay: Int - extraBufferCapacity: Int - onBufferOverflow: BufferOverflow MutableSharedFlow [**interface**](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-mutable-shared-flow/), in turn, says in its documentation that an instance can be created using this...
While it's still closely bound to #1147, it's worth investigating and draft-designing the original operators stabilization, so our `flatMap` analogue will be available for users who don't use any experimental...
See https://youtrack.jetbrains.com/issue/KT-66006
Copying from https://github.com/Kotlin/kotlinx.coroutines/pull/4147#discussion_r1696736494: --- *How* does one use `LAZY`? Typically, in a pattern like ```kotlin // a property val optionallyRequiredValue = scope.async(start = CoroutineStart.LAZY) { // ... } ``` But...