diff --git a/kotlinx-coroutines-core/common/src/channels/ConflatedChannel.kt b/kotlinx-coroutines-core/common/src/channels/ConflatedChannel.kt index f7f60cf97d..177e80cb49 100644 --- a/kotlinx-coroutines-core/common/src/channels/ConflatedChannel.kt +++ b/kotlinx-coroutines-core/common/src/channels/ConflatedChannel.kt @@ -19,7 +19,7 @@ import kotlinx.coroutines.selects.* */ internal open class ConflatedChannel(onUndeliveredElement: OnUndeliveredElement?) : AbstractChannel(onUndeliveredElement) { protected final override val isBufferAlwaysEmpty: Boolean get() = false - protected final override val isBufferEmpty: Boolean get() = value === EMPTY + protected final override val isBufferEmpty: Boolean get() = lock.withLock { value === EMPTY } protected final override val isBufferAlwaysFull: Boolean get() = false protected final override val isBufferFull: Boolean get() = false @@ -139,5 +139,5 @@ internal open class ConflatedChannel(onUndeliveredElement: OnUndeliveredEleme // ------ debug ------ override val bufferDebugString: String - get() = "(value=$value)" + get() = lock.withLock { "(value=$value)" } }