Skip to content

Commit d3e718e

Browse files
committed
AwaitAllNode disposer may be just a volatile property
1 parent 3123e27 commit d3e718e

File tree

1 file changed

+3
-2
lines changed
  • kotlinx-coroutines-core/common/src

1 file changed

+3
-2
lines changed

kotlinx-coroutines-core/common/src/Await.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package kotlinx.coroutines
66

77
import kotlinx.atomicfu.*
88
import kotlin.coroutines.*
9+
import kotlin.jvm.*
910

1011
/**
1112
* Awaits for completion of given deferred values without blocking a thread and resumes normally with the list of values
@@ -103,8 +104,8 @@ private class AwaitAll<T>(private val deferreds: Array<out Deferred<T>>) {
103104
private inner class AwaitAllNode(private val continuation: CancellableContinuation<List<T>>) : JobNode() {
104105
lateinit var handle: DisposableHandle
105106

106-
private val _disposer = atomic<DisposeHandlersOnCancel?>(null)
107-
var disposer: DisposeHandlersOnCancel? by _disposer
107+
@Volatile
108+
var disposer: DisposeHandlersOnCancel? = null
108109

109110
override fun invoke(cause: Throwable?) {
110111
if (cause != null) {

0 commit comments

Comments
 (0)