Fixed boxing of SuccessOrFailure inside SafeContinuation impl

This commit is contained in:
Roman Elizarov
2018-07-03 13:10:17 +03:00
committed by Denis Zharkov
parent 0370fac0b6
commit d33409ff8a
2 changed files with 2 additions and 2 deletions
@@ -36,7 +36,7 @@ internal actual constructor(
while (true) { // lock-free loop
val cur = this.result // atomic read
when {
cur === UNDECIDED -> if (RESULT.compareAndSet(this, UNDECIDED, result)) return
cur === UNDECIDED -> if (RESULT.compareAndSet(this, UNDECIDED, result._value)) return
cur === COROUTINE_SUSPENDED -> if (RESULT.compareAndSet(this, COROUTINE_SUSPENDED, RESUMED)) {
delegate.resumeWith(result)
return
@@ -19,7 +19,7 @@ import kotlin.internal.InlineOnly
import kotlin.jvm.JvmField
@SinceKotlin("1.3")
public inline class SuccessOrFailure<out T> @PublishedApi internal constructor(private val _value: Any?) {
public inline class SuccessOrFailure<out T> @PublishedApi internal constructor(internal val _value: Any?) {
// discovery
public val isSuccess: Boolean get() = _value !is Failure