discord-jadx/app/src/main/java/d0/w/g.java

90 lines
2.9 KiB
Java
Raw Normal View History

2021-11-02 06:38:17 +00:00
package d0.w;
2021-08-25 07:02:36 +00:00
2021-11-02 06:38:17 +00:00
import d0.k;
import d0.w.h.c;
import d0.z.d.m;
2021-08-25 07:02:36 +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 */
2022-03-07 09:34:54 +00:00
/* loaded from: classes3.dex */
2021-08-25 07:02:36 +00:00
public final class g<T> implements Continuation<T>, CoroutineStackFrame {
@Deprecated
2021-12-02 18:53:44 +00:00
public static final AtomicReferenceFieldUpdater<g<?>, Object> j = AtomicReferenceFieldUpdater.newUpdater(g.class, Object.class, "result");
public final Continuation<T> k;
2021-08-25 07:02:36 +00:00
public volatile Object result;
/* compiled from: SafeContinuationJvm.kt */
2022-03-07 09:34:54 +00:00
/* loaded from: classes3.dex */
2021-08-25 07:02:36 +00:00
public static final class a {
public a(DefaultConstructorMarker defaultConstructorMarker) {
}
}
static {
new a(null);
}
2022-03-07 09:34:54 +00:00
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
2021-08-25 07:02:36 +00:00
public g(Continuation<? super T> continuation) {
2021-11-02 06:38:17 +00:00
this(continuation, d0.w.h.a.UNDECIDED);
2021-08-25 07:02:36 +00:00
m.checkNotNullParameter(continuation, "delegate");
}
/* JADX WARN: Multi-variable type inference failed */
public g(Continuation<? super T> continuation, Object obj) {
m.checkNotNullParameter(continuation, "delegate");
2021-12-02 18:53:44 +00:00
this.k = continuation;
2021-08-25 07:02:36 +00:00
this.result = obj;
}
@Override // kotlin.coroutines.Continuation
public CoroutineContext getContext() {
2021-12-02 18:53:44 +00:00
return this.k.getContext();
2021-08-25 07:02:36 +00:00
}
public final Object getOrThrow() {
Object obj = this.result;
2021-11-02 06:38:17 +00:00
d0.w.h.a aVar = d0.w.h.a.UNDECIDED;
2021-08-25 07:02:36 +00:00
if (obj == aVar) {
2021-12-02 18:53:44 +00:00
if (j.compareAndSet(this, aVar, c.getCOROUTINE_SUSPENDED())) {
2021-08-25 07:02:36 +00:00
return c.getCOROUTINE_SUSPENDED();
}
obj = this.result;
}
2021-11-02 06:38:17 +00:00
if (obj == d0.w.h.a.RESUMED) {
2021-08-25 07:02:36 +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-02 06:38:17 +00:00
d0.w.h.a aVar = d0.w.h.a.UNDECIDED;
2021-08-25 07:02:36 +00:00
if (obj2 == aVar) {
2021-12-02 18:53:44 +00:00
if (j.compareAndSet(this, aVar, obj)) {
2021-08-25 07:02:36 +00:00
return;
}
} else if (obj2 != c.getCOROUTINE_SUSPENDED()) {
throw new IllegalStateException("Already resumed");
2021-12-02 18:53:44 +00:00
} else if (j.compareAndSet(this, c.getCOROUTINE_SUSPENDED(), d0.w.h.a.RESUMED)) {
this.k.resumeWith(obj);
2021-08-25 07:02:36 +00:00
return;
}
}
}
public String toString() {
2022-03-21 18:52:30 +00:00
StringBuilder R = b.d.b.a.a.R("SafeContinuation for ");
R.append(this.k);
return R.toString();
2021-08-25 07:02:36 +00:00
}
}