2021-11-08 18:25:28 +00:00
|
|
|
package d0.w;
|
2021-09-14 19:31:33 +00:00
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
import d0.k;
|
|
|
|
import d0.w.h.c;
|
|
|
|
import d0.z.d.m;
|
2021-09-14 19:31:33 +00:00
|
|
|
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
|
|
|
|
import kotlin.coroutines.Continuation;
|
|
|
|
import kotlin.coroutines.CoroutineContext;
|
|
|
|
import kotlin.coroutines.jvm.internal.CoroutineStackFrame;
|
|
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
|
|
/* compiled from: SafeContinuationJvm.kt */
|
|
|
|
public final class g<T> implements Continuation<T>, CoroutineStackFrame {
|
|
|
|
@Deprecated
|
2021-12-17 22:03:14 +00:00
|
|
|
public static final AtomicReferenceFieldUpdater<g<?>, Object> j = AtomicReferenceFieldUpdater.newUpdater(g.class, Object.class, "result");
|
|
|
|
public final Continuation<T> k;
|
2021-09-14 19:31:33 +00:00
|
|
|
public volatile Object result;
|
|
|
|
|
|
|
|
/* compiled from: SafeContinuationJvm.kt */
|
|
|
|
public static final class a {
|
|
|
|
public a(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static {
|
|
|
|
new a(null);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
|
|
public g(Continuation<? super T> continuation) {
|
2021-11-08 18:25:28 +00:00
|
|
|
this(continuation, d0.w.h.a.UNDECIDED);
|
2021-09-14 19:31:33 +00:00
|
|
|
m.checkNotNullParameter(continuation, "delegate");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r2v0, resolved type: kotlin.coroutines.Continuation<? super T> */
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
|
|
public g(Continuation<? super T> continuation, Object obj) {
|
|
|
|
m.checkNotNullParameter(continuation, "delegate");
|
2021-12-17 22:03:14 +00:00
|
|
|
this.k = continuation;
|
2021-09-14 19:31:33 +00:00
|
|
|
this.result = obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // kotlin.coroutines.Continuation
|
|
|
|
public CoroutineContext getContext() {
|
2021-12-17 22:03:14 +00:00
|
|
|
return this.k.getContext();
|
2021-09-14 19:31:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final Object getOrThrow() {
|
|
|
|
Object obj = this.result;
|
2021-11-08 18:25:28 +00:00
|
|
|
d0.w.h.a aVar = d0.w.h.a.UNDECIDED;
|
2021-09-14 19:31:33 +00:00
|
|
|
if (obj == aVar) {
|
2021-12-17 22:03:14 +00:00
|
|
|
if (j.compareAndSet(this, aVar, c.getCOROUTINE_SUSPENDED())) {
|
2021-09-14 19:31:33 +00:00
|
|
|
return c.getCOROUTINE_SUSPENDED();
|
|
|
|
}
|
|
|
|
obj = this.result;
|
|
|
|
}
|
2021-11-08 18:25:28 +00:00
|
|
|
if (obj == d0.w.h.a.RESUMED) {
|
2021-09-14 19:31:33 +00:00
|
|
|
return c.getCOROUTINE_SUSPENDED();
|
|
|
|
}
|
|
|
|
if (!(obj instanceof k.b)) {
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
throw ((k.b) obj).exception;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // kotlin.coroutines.Continuation
|
|
|
|
public void resumeWith(Object obj) {
|
|
|
|
while (true) {
|
|
|
|
Object obj2 = this.result;
|
2021-11-08 18:25:28 +00:00
|
|
|
d0.w.h.a aVar = d0.w.h.a.UNDECIDED;
|
2021-09-14 19:31:33 +00:00
|
|
|
if (obj2 == aVar) {
|
2021-12-17 22:03:14 +00:00
|
|
|
if (j.compareAndSet(this, aVar, obj)) {
|
2021-09-14 19:31:33 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else if (obj2 != c.getCOROUTINE_SUSPENDED()) {
|
|
|
|
throw new IllegalStateException("Already resumed");
|
2021-12-17 22:03:14 +00:00
|
|
|
} else if (j.compareAndSet(this, c.getCOROUTINE_SUSPENDED(), d0.w.h.a.RESUMED)) {
|
|
|
|
this.k.resumeWith(obj);
|
2021-09-14 19:31:33 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
2021-11-08 18:25:28 +00:00
|
|
|
StringBuilder R = c.d.b.a.a.R("SafeContinuation for ");
|
2021-12-17 22:03:14 +00:00
|
|
|
R.append(this.k);
|
2021-11-08 18:25:28 +00:00
|
|
|
return R.toString();
|
2021-09-14 19:31:33 +00:00
|
|
|
}
|
|
|
|
}
|