Fixed boxing of SuccessOrFailure inside SafeContinuation impl
This commit is contained in:
committed by
Denis Zharkov
parent
0370fac0b6
commit
d33409ff8a
@@ -36,7 +36,7 @@ internal actual constructor(
|
|||||||
while (true) { // lock-free loop
|
while (true) { // lock-free loop
|
||||||
val cur = this.result // atomic read
|
val cur = this.result // atomic read
|
||||||
when {
|
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)) {
|
cur === COROUTINE_SUSPENDED -> if (RESULT.compareAndSet(this, COROUTINE_SUSPENDED, RESUMED)) {
|
||||||
delegate.resumeWith(result)
|
delegate.resumeWith(result)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import kotlin.internal.InlineOnly
|
|||||||
import kotlin.jvm.JvmField
|
import kotlin.jvm.JvmField
|
||||||
|
|
||||||
@SinceKotlin("1.3")
|
@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
|
// discovery
|
||||||
|
|
||||||
public val isSuccess: Boolean get() = _value !is Failure
|
public val isSuccess: Boolean get() = _value !is Failure
|
||||||
|
|||||||
Reference in New Issue
Block a user