Fix Volatile usages in common and JS code

This commit is contained in:
Ilya Gorbunov
2017-12-26 07:04:48 +03:00
parent a33a3867b8
commit 042f81f23b
2 changed files with 3 additions and 5 deletions
+1 -3
View File
@@ -17,10 +17,8 @@
package kotlin.sequences
internal class ConstrainedOnceSequence<T>(sequence: Sequence<T>) : Sequence<T> {
@Volatile private var sequenceRef: Sequence<T>? = sequence
//private val lock = Any()
private var sequenceRef: Sequence<T>? = sequence
//TODO: Synchronize with the synchonized() method
override fun iterator(): Iterator<T> {
val sequence = sequenceRef ?: throw IllegalStateException("This sequence can be consumed only once.")
sequenceRef = null