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

89 lines
2.9 KiB
Java
Raw Normal View History

2021-10-19 23:48:27 +00:00
package c0.w;
2021-09-14 19:31:33 +00:00
2021-10-19 23:48:27 +00:00
import c0.k;
import c0.w.h.c;
import c0.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
public static final AtomicReferenceFieldUpdater<g<?>, Object> i = AtomicReferenceFieldUpdater.newUpdater(g.class, Object.class, "result");
public final Continuation<T> j;
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-10-19 23:48:27 +00:00
this(continuation, c0.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");
this.j = continuation;
this.result = obj;
}
@Override // kotlin.coroutines.Continuation
public CoroutineContext getContext() {
return this.j.getContext();
}
public final Object getOrThrow() {
Object obj = this.result;
2021-10-19 23:48:27 +00:00
c0.w.h.a aVar = c0.w.h.a.UNDECIDED;
2021-09-14 19:31:33 +00:00
if (obj == aVar) {
if (i.compareAndSet(this, aVar, c.getCOROUTINE_SUSPENDED())) {
return c.getCOROUTINE_SUSPENDED();
}
obj = this.result;
}
2021-10-19 23:48:27 +00:00
if (obj == c0.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-10-19 23:48:27 +00:00
c0.w.h.a aVar = c0.w.h.a.UNDECIDED;
2021-09-14 19:31:33 +00:00
if (obj2 == aVar) {
if (i.compareAndSet(this, aVar, obj)) {
return;
}
} else if (obj2 != c.getCOROUTINE_SUSPENDED()) {
throw new IllegalStateException("Already resumed");
2021-10-19 23:48:27 +00:00
} else if (i.compareAndSet(this, c.getCOROUTINE_SUSPENDED(), c0.w.h.a.RESUMED)) {
2021-09-14 19:31:33 +00:00
this.j.resumeWith(obj);
return;
}
}
}
public String toString() {
2021-10-14 23:16:01 +00:00
StringBuilder O = c.d.b.a.a.O("SafeContinuation for ");
O.append(this.j);
return O.toString();
2021-09-14 19:31:33 +00:00
}
}