We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0b886a3 commit 9304d60Copy full SHA for 9304d60
common/kotlinx-coroutines-core-common/src/Builders.common.kt
@@ -161,9 +161,13 @@ private open class StandaloneCoroutine(
161
162
private class LazyStandaloneCoroutine(
163
parentContext: CoroutineContext,
164
- private val block: suspend CoroutineScope.() -> Unit
+ block: suspend CoroutineScope.() -> Unit
165
) : StandaloneCoroutine(parentContext, active = false) {
166
+ private var block: (suspend CoroutineScope.() -> Unit)? = block
167
+
168
override fun onStart() {
169
+ val block = checkNotNull(this.block) { "Already started" }
170
+ this.block = null
171
block.startCoroutineCancellable(this, this)
172
}
173
0 commit comments