CrackMe.apk
Download file
package kotlinx.coroutines.selects;
import androidx.concurrent.futures.AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0;
import java.util.Objects;
import java.util.concurrent.CancellationException;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlin.Metadata;
import kotlin.Result;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.coroutines.jvm.internal.CoroutineStackFrame;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.CancellableContinuationImplKt;
import kotlinx.coroutines.CompletedExceptionally;
import kotlinx.coroutines.CompletionStateKt;
import kotlinx.coroutines.CoroutineExceptionHandlerKt;
import kotlinx.coroutines.DebugKt;
import kotlinx.coroutines.DelayKt;
import kotlinx.coroutines.DisposableHandle;
import kotlinx.coroutines.Job;
import kotlinx.coroutines.JobCancellingNode;
import kotlinx.coroutines.internal.AtomicDesc;
import kotlinx.coroutines.internal.AtomicKt;
import kotlinx.coroutines.internal.AtomicOp;
import kotlinx.coroutines.internal.LockFreeLinkedListHead;
import kotlinx.coroutines.internal.LockFreeLinkedListNode;
import kotlinx.coroutines.internal.OpDescriptor;
import kotlinx.coroutines.internal.StackTraceRecoveryKt;
import kotlinx.coroutines.intrinsics.UndispatchedKt;
import kotlinx.coroutines.selects.SelectBuilder;
@Metadata(d1 = {"\u0000®\u0001\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0003\n\u0002\b\u0004\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u000e\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\b\u0001\u0018\u0000*\u0006\b\u0000\u0010\u0001 \u00002\u00020Y2\b\u0012\u0004\u0012\u00028\u00000Z2\b\u0012\u0004\u0012\u00028\u00000[2\b\u0012\u0004\u0012\u00028\u00000\u00022\u00060Bj\u0002`C:\u0004TUVWB\u0015\u0012\f\u0010\u0003\u001a\b\u0012\u0004\u0012\u00028\u00000\u0002¢\u0006\u0004\b\u0004\u0010\u0005J\u0017\u0010\t\u001a\u00020\b2\u0006\u0010\u0007\u001a\u00020\u0006H\u0016¢\u0006\u0004\b\t\u0010\nJ\u000f\u0010\u000b\u001a\u00020\bH\u0002¢\u0006\u0004\b\u000b\u0010\fJ.\u0010\u0011\u001a\u00020\b2\u000e\u0010\u000f\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u000e0\r2\f\u0010\u0010\u001a\b\u0012\u0004\u0012\u00020\b0\rH\b¢\u0006\u0004\b\u0011\u0010\u0012J\u0011\u0010\u0013\u001a\u0004\u0018\u00010\u000eH\u0001¢\u0006\u0004\b\u0013\u0010\u0014J\u0017\u0010\u0017\u001a\n\u0018\u00010\u0015j\u0004\u0018\u0001`\u0016H\u0016¢\u0006\u0004\b\u0017\u0010\u0018J\u0017\u0010\u001b\u001a\u00020\b2\u0006\u0010\u001a\u001a\u00020\u0019H\u0001¢\u0006\u0004\b\u001b\u0010\u001cJ\u000f\u0010\u001d\u001a\u00020\bH\u0002¢\u0006\u0004\b\u001d\u0010\fJ8\u0010!\u001a\u00020\b2\u0006\u0010\u001f\u001a\u00020\u001e2\u001c\u0010\u0010\u001a\u0018\b\u0001\u0012\n\u0012\b\u0012\u0004\u0012\u00028\u00000\u0002\u0012\u0006\u0012\u0004\u0018\u00010\u000e0 H\u0016ø\u0001\u0000¢\u0006\u0004\b!\u0010\"J\u0019\u0010%\u001a\u0004\u0018\u00010\u000e2\u0006\u0010$\u001a\u00020#H\u0016¢\u0006\u0004\b%\u0010&J\u0017\u0010(\u001a\u00020\b2\u0006\u0010'\u001a\u00020\u0019H\u0016¢\u0006\u0004\b(\u0010\u001cJ \u0010+\u001a\u00020\b2\f\u0010*\u001a\b\u0012\u0004\u0012\u00028\u00000)H\u0016ø\u0001\u0000¢\u0006\u0004\b+\u0010,J\u000f\u0010.\u001a\u00020-H\u0016¢\u0006\u0004\b.\u0010/J\u000f\u00101\u001a\u000200H\u0016¢\u0006\u0004\b1\u00102J\u001b\u00105\u001a\u0004\u0018\u00010\u000e2\b\u00104\u001a\u0004\u0018\u000103H\u0016¢\u0006\u0004\b5\u00106J5\u00108\u001a\u00020\b*\u0002072\u001c\u0010\u0010\u001a\u0018\b\u0001\u0012\n\u0012\b\u0012\u0004\u0012\u00028\u00000\u0002\u0012\u0006\u0012\u0004\u0018\u00010\u000e0 H\u0002ø\u0001\u0000¢\u0006\u0004\b8\u00109JG\u00108\u001a\u00020\b\"\u0004\b\u0001\u0010:*\b\u0012\u0004\u0012\u00028\u00010;2\"\u0010\u0010\u001a\u001e\b\u0001\u0012\u0004\u0012\u00028\u0001\u0012\n\u0012\b\u0012\u0004\u0012\u00028\u00000\u0002\u0012\u0006\u0012\u0004\u0018\u00010\u000e0<H\u0002ø\u0001\u0000¢\u0006\u0004\b8\u0010=J[\u00108\u001a\u00020\b\"\u0004\b\u0001\u0010>\"\u0004\b\u0002\u0010:*\u000e\u0012\u0004\u0012\u00028\u0001\u0012\u0004\u0012\u00028\u00020?2\u0006\u0010@\u001a\u00028\u00012\"\u0010\u0010\u001a\u001e\b\u0001\u0012\u0004\u0012\u00028\u0002\u0012\n\u0012\b\u0012\u0004\u0012\u00028\u00000\u0002\u0012\u0006\u0012\u0004\u0018\u00010\u000e0<H\u0002ø\u0001\u0000¢\u0006\u0004\b8\u0010AR\u001c\u0010F\u001a\n\u0018\u00010Bj\u0004\u0018\u0001`C8VX\u0004¢\u0006\u0006\u001a\u0004\bD\u0010ER\u001a\u0010I\u001a\b\u0012\u0004\u0012\u00028\u00000\u00028VX\u0004¢\u0006\u0006\u001a\u0004\bG\u0010HR\u0014\u0010M\u001a\u00020J8VX\u0004¢\u0006\u0006\u001a\u0004\bK\u0010LR\u0014\u0010N\u001a\u0002008VX\u0004¢\u0006\u0006\u001a\u0004\bN\u00102R(\u0010R\u001a\u0004\u0018\u00010\u00062\b\u0010\u000f\u001a\u0004\u0018\u00010\u00068B@BX\u000e¢\u0006\f\u001a\u0004\bO\u0010P\"\u0004\bQ\u0010\nR\u001a\u0010\u0003\u001a\b\u0012\u0004\u0012\u00028\u00000\u00028\u0002X\u0004¢\u0006\u0006\n\u0004\b\u0003\u0010S\u0002\u0004\n\u0002\b\u0019¨\u0006X"}, d2 = {"Lkotlinx/coroutines/selects/SelectBuilderImpl;", "R", "Lkotlin/coroutines/Continuation;", "uCont", "<init>", "(Lkotlin/coroutines/Continuation;)V", "Lkotlinx/coroutines/DisposableHandle;", "handle", "", "disposeOnSelect", "(Lkotlinx/coroutines/DisposableHandle;)V", "doAfterSelect", "()V", "Lkotlin/Function0;", "", "value", "block", "doResume", "(Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;)V", "getResult", "()Ljava/lang/Object;", "Ljava/lang/StackTraceElement;", "Lkotlinx/coroutines/internal/StackTraceElement;", "getStackTraceElement", "()Ljava/lang/StackTraceElement;", "", "e", "handleBuilderException", "(Ljava/lang/Throwable;)V", "initCancellability", "", "timeMillis", "Lkotlin/Function1;", "onTimeout", "(JLkotlin/jvm/functions/Function1;)V", "Lkotlinx/coroutines/internal/AtomicDesc;", "desc", "performAtomicTrySelect", "(Lkotlinx/coroutines/internal/AtomicDesc;)Ljava/lang/Object;", "exception", "resumeSelectWithException", "Lkotlin/Result;", "result", "resumeWith", "(Ljava/lang/Object;)V", "", "toString", "()Ljava/lang/String;", "", "trySelect", "()Z", "Lkotlinx/coroutines/internal/LockFreeLinkedListNode$PrepareOp;", "otherOp", "trySelectOther", "(Lkotlinx/coroutines/internal/LockFreeLinkedListNode$PrepareOp;)Ljava/lang/Object;", "Lkotlinx/coroutines/selects/SelectClause0;", "invoke", "(Lkotlinx/coroutines/selects/SelectClause0;Lkotlin/jvm/functions/Function1;)V", "Q", "Lkotlinx/coroutines/selects/SelectClause1;", "Lkotlin/Function2;", "(Lkotlinx/coroutines/selects/SelectClause1;Lkotlin/jvm/functions/Function2;)V", "P", "Lkotlinx/coroutines/selects/SelectClause2;", "param", "(Lkotlinx/coroutines/selects/SelectClause2;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)V", "Lkotlin/coroutines/jvm/internal/CoroutineStackFrame;", "Lkotlinx/coroutines/internal/CoroutineStackFrame;", "getCallerFrame", "()Lkotlin/coroutines/jvm/internal/CoroutineStackFrame;", "callerFrame", "getCompletion", "()Lkotlin/coroutines/Continuation;", "completion", "Lkotlin/coroutines/CoroutineContext;", "getContext", "()Lkotlin/coroutines/CoroutineContext;", "context", "isSelected", "getParentHandle", "()Lkotlinx/coroutines/DisposableHandle;", "setParentHandle", "parentHandle", "Lkotlin/coroutines/Continuation;", "AtomicSelectOp", "DisposeNode", "PairSelectOp", "SelectOnCancelling", "kotlinx-coroutines-core", "Lkotlinx/coroutines/internal/LockFreeLinkedListHead;", "Lkotlinx/coroutines/selects/SelectBuilder;", "Lkotlinx/coroutines/selects/SelectInstance;"}, k = 1, mv = {1, 6, 0}, xi = 48)
/* compiled from: Select.kt */
public final class SelectBuilderImpl<R> extends LockFreeLinkedListHead implements SelectBuilder<R>, SelectInstance<R>, Continuation<R>, CoroutineStackFrame {
private static final /* synthetic */ AtomicReferenceFieldUpdater _result$FU;
static final /* synthetic */ AtomicReferenceFieldUpdater _state$FU;
private volatile /* synthetic */ Object _parentHandle = null;
private volatile /* synthetic */ Object _result = SelectKt.UNDECIDED;
volatile /* synthetic */ Object _state = SelectKt.getNOT_SELECTED();
private final Continuation<R> uCont;
static {
Class<SelectBuilderImpl> cls = SelectBuilderImpl.class;
_state$FU = AtomicReferenceFieldUpdater.newUpdater(cls, Object.class, "_state");
_result$FU = AtomicReferenceFieldUpdater.newUpdater(cls, Object.class, "_result");
}
public StackTraceElement getStackTraceElement() {
return null;
}
public <P, Q> void invoke(SelectClause2<? super P, ? extends Q> selectClause2, Function2<? super Q, ? super Continuation<? super R>, ? extends Object> function2) {
SelectBuilder.DefaultImpls.invoke(this, selectClause2, function2);
}
public SelectBuilderImpl(Continuation<? super R> continuation) {
this.uCont = continuation;
}
public CoroutineStackFrame getCallerFrame() {
Continuation<R> continuation = this.uCont;
if (continuation instanceof CoroutineStackFrame) {
return (CoroutineStackFrame) continuation;
}
return null;
}
private final DisposableHandle getParentHandle() {
return (DisposableHandle) this._parentHandle;
}
private final void setParentHandle(DisposableHandle disposableHandle) {
this._parentHandle = disposableHandle;
}
public CoroutineContext getContext() {
return this.uCont.getContext();
}
public Continuation<R> getCompletion() {
return this;
}
private final void doResume(Function0<? extends Object> function0, Function0<Unit> function02) {
if (!DebugKt.getASSERTIONS_ENABLED() || isSelected()) {
while (true) {
Object obj = this._result;
if (obj == SelectKt.UNDECIDED) {
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_result$FU, this, SelectKt.UNDECIDED, function0.invoke())) {
return;
}
} else if (obj != IntrinsicsKt.getCOROUTINE_SUSPENDED()) {
throw new IllegalStateException("Already resumed");
} else if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_result$FU, this, IntrinsicsKt.getCOROUTINE_SUSPENDED(), SelectKt.RESUMED)) {
function02.invoke();
return;
}
}
} else {
throw new AssertionError();
}
}
public final Object getResult() {
if (!isSelected()) {
initCancellability();
}
Object obj = this._result;
if (obj == SelectKt.UNDECIDED) {
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_result$FU, this, SelectKt.UNDECIDED, IntrinsicsKt.getCOROUTINE_SUSPENDED())) {
return IntrinsicsKt.getCOROUTINE_SUSPENDED();
}
obj = this._result;
}
if (obj == SelectKt.RESUMED) {
throw new IllegalStateException("Already resumed");
} else if (!(obj instanceof CompletedExceptionally)) {
return obj;
} else {
throw ((CompletedExceptionally) obj).cause;
}
}
private final void initCancellability() {
Job job = (Job) getContext().get(Job.Key);
if (job != null) {
DisposableHandle invokeOnCompletion$default = Job.DefaultImpls.invokeOnCompletion$default(job, true, false, new SelectOnCancelling(), 2, (Object) null);
setParentHandle(invokeOnCompletion$default);
if (isSelected()) {
invokeOnCompletion$default.dispose();
}
}
}
@Metadata(d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u0003\n\u0000\b\u0004\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0013\u0010\u0003\u001a\u00020\u00042\b\u0010\u0005\u001a\u0004\u0018\u00010\u0006H\u0002¨\u0006\u0007"}, d2 = {"Lkotlinx/coroutines/selects/SelectBuilderImpl$SelectOnCancelling;", "Lkotlinx/coroutines/JobCancellingNode;", "(Lkotlinx/coroutines/selects/SelectBuilderImpl;)V", "invoke", "", "cause", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 6, 0}, xi = 48)
/* compiled from: Select.kt */
private final class SelectOnCancelling extends JobCancellingNode {
public SelectOnCancelling() {
}
public /* bridge */ /* synthetic */ Object invoke(Object obj) {
invoke((Throwable) obj);
return Unit.INSTANCE;
}
public void invoke(Throwable th) {
if (SelectBuilderImpl.this.trySelect()) {
SelectBuilderImpl.this.resumeSelectWithException(getJob().getCancellationException());
}
}
}
public final void handleBuilderException(Throwable th) {
if (trySelect()) {
Result.Companion companion = Result.Companion;
resumeWith(Result.m352constructorimpl(ResultKt.createFailure(th)));
} else if (!(th instanceof CancellationException)) {
Object result = getResult();
if (result instanceof CompletedExceptionally) {
Throwable th2 = ((CompletedExceptionally) result).cause;
if (DebugKt.getRECOVER_STACK_TRACES()) {
th2 = StackTraceRecoveryKt.unwrapImpl(th2);
}
if (th2 == (!DebugKt.getRECOVER_STACK_TRACES() ? th : StackTraceRecoveryKt.unwrapImpl(th))) {
return;
}
}
CoroutineExceptionHandlerKt.handleCoroutineException(getContext(), th);
}
}
public void disposeOnSelect(DisposableHandle disposableHandle) {
DisposeNode disposeNode = new DisposeNode(disposableHandle);
if (!isSelected()) {
addLast(disposeNode);
if (!isSelected()) {
return;
}
}
disposableHandle.dispose();
}
/* access modifiers changed from: private */
public final void doAfterSelect() {
DisposableHandle parentHandle = getParentHandle();
if (parentHandle != null) {
parentHandle.dispose();
}
LockFreeLinkedListHead lockFreeLinkedListHead = this;
for (LockFreeLinkedListNode lockFreeLinkedListNode = (LockFreeLinkedListNode) lockFreeLinkedListHead.getNext(); !Intrinsics.areEqual((Object) lockFreeLinkedListNode, (Object) lockFreeLinkedListHead); lockFreeLinkedListNode = lockFreeLinkedListNode.getNextNode()) {
if (lockFreeLinkedListNode instanceof DisposeNode) {
((DisposeNode) lockFreeLinkedListNode).handle.dispose();
}
}
}
public boolean trySelect() {
Object trySelectOther = trySelectOther((LockFreeLinkedListNode.PrepareOp) null);
if (trySelectOther == CancellableContinuationImplKt.RESUME_TOKEN) {
return true;
}
if (trySelectOther == null) {
return false;
}
throw new IllegalStateException(Intrinsics.stringPlus("Unexpected trySelectIdempotent result ", trySelectOther).toString());
}
@Metadata(d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0000\n\u0002\b\u0002\b\u0002\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\u0014\u0010\t\u001a\u0004\u0018\u00010\n2\b\u0010\u000b\u001a\u0004\u0018\u00010\nH\u0016R\u0018\u0010\u0005\u001a\u0006\u0012\u0002\b\u00030\u00068VX\u0004¢\u0006\u0006\u001a\u0004\b\u0007\u0010\bR\u0010\u0010\u0002\u001a\u00020\u00038\u0006X\u0004¢\u0006\u0002\n\u0000¨\u0006\f"}, d2 = {"Lkotlinx/coroutines/selects/SelectBuilderImpl$PairSelectOp;", "Lkotlinx/coroutines/internal/OpDescriptor;", "otherOp", "Lkotlinx/coroutines/internal/LockFreeLinkedListNode$PrepareOp;", "(Lkotlinx/coroutines/internal/LockFreeLinkedListNode$PrepareOp;)V", "atomicOp", "Lkotlinx/coroutines/internal/AtomicOp;", "getAtomicOp", "()Lkotlinx/coroutines/internal/AtomicOp;", "perform", "", "affected", "kotlinx-coroutines-core"}, k = 1, mv = {1, 6, 0}, xi = 48)
/* compiled from: Select.kt */
private static final class PairSelectOp extends OpDescriptor {
public final LockFreeLinkedListNode.PrepareOp otherOp;
public PairSelectOp(LockFreeLinkedListNode.PrepareOp prepareOp) {
this.otherOp = prepareOp;
}
public Object perform(Object obj) {
Objects.requireNonNull(obj, "null cannot be cast to non-null type kotlinx.coroutines.selects.SelectBuilderImpl<*>");
SelectBuilderImpl selectBuilderImpl = (SelectBuilderImpl) obj;
this.otherOp.finishPrepare();
Object decide = this.otherOp.getAtomicOp().decide((Object) null);
AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(SelectBuilderImpl._state$FU, selectBuilderImpl, this, decide == null ? this.otherOp.desc : SelectKt.getNOT_SELECTED());
return decide;
}
public AtomicOp<?> getAtomicOp() {
return this.otherOp.getAtomicOp();
}
}
public Object performAtomicTrySelect(AtomicDesc atomicDesc) {
return new AtomicSelectOp(this, atomicDesc).perform((Object) null);
}
public String toString() {
return "SelectInstance(state=" + this._state + ", result=" + this._result + ')';
}
@Metadata(d1 = {"\u00004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\t\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\u0006\n\u0002\u0010\u000e\n\u0002\b\u0002\b\u0002\u0018\u00002\n\u0012\u0006\u0012\u0004\u0018\u00010\u00020\u0001B\u0019\u0012\n\u0010\u0003\u001a\u0006\u0012\u0002\b\u00030\u0004\u0012\u0006\u0010\u0005\u001a\u00020\u0006¢\u0006\u0002\u0010\u0007J\u001c\u0010\f\u001a\u00020\r2\b\u0010\u000e\u001a\u0004\u0018\u00010\u00022\b\u0010\u000f\u001a\u0004\u0018\u00010\u0002H\u0016J\u0012\u0010\u0010\u001a\u00020\r2\b\u0010\u000f\u001a\u0004\u0018\u00010\u0002H\u0002J\u0014\u0010\u0011\u001a\u0004\u0018\u00010\u00022\b\u0010\u000e\u001a\u0004\u0018\u00010\u0002H\u0016J\n\u0010\u0012\u001a\u0004\u0018\u00010\u0002H\u0002J\b\u0010\u0013\u001a\u00020\u0014H\u0016J\b\u0010\u0015\u001a\u00020\rH\u0002R\u0010\u0010\u0005\u001a\u00020\u00068\u0006X\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0003\u001a\u0006\u0012\u0002\b\u00030\u00048\u0006X\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\b\u001a\u00020\tX\u0004¢\u0006\b\n\u0000\u001a\u0004\b\n\u0010\u000b¨\u0006\u0016"}, d2 = {"Lkotlinx/coroutines/selects/SelectBuilderImpl$AtomicSelectOp;", "Lkotlinx/coroutines/internal/AtomicOp;", "", "impl", "Lkotlinx/coroutines/selects/SelectBuilderImpl;", "desc", "Lkotlinx/coroutines/internal/AtomicDesc;", "(Lkotlinx/coroutines/selects/SelectBuilderImpl;Lkotlinx/coroutines/internal/AtomicDesc;)V", "opSequence", "", "getOpSequence", "()J", "complete", "", "affected", "failure", "completeSelect", "prepare", "prepareSelectOp", "toString", "", "undoPrepare", "kotlinx-coroutines-core"}, k = 1, mv = {1, 6, 0}, xi = 48)
/* compiled from: Select.kt */
private static final class AtomicSelectOp extends AtomicOp<Object> {
public final AtomicDesc desc;
public final SelectBuilderImpl<?> impl;
private final long opSequence = SelectKt.selectOpSequenceNumber.next();
public AtomicSelectOp(SelectBuilderImpl<?> selectBuilderImpl, AtomicDesc atomicDesc) {
this.impl = selectBuilderImpl;
this.desc = atomicDesc;
atomicDesc.setAtomicOp(this);
}
public long getOpSequence() {
return this.opSequence;
}
public Object prepare(Object obj) {
Object prepareSelectOp;
if (obj == null && (prepareSelectOp = prepareSelectOp()) != null) {
return prepareSelectOp;
}
try {
return this.desc.prepare(this);
} catch (Throwable th) {
if (obj == null) {
undoPrepare();
}
throw th;
}
}
public void complete(Object obj, Object obj2) {
completeSelect(obj2);
this.desc.complete(this, obj2);
}
private final Object prepareSelectOp() {
SelectBuilderImpl<?> selectBuilderImpl = this.impl;
while (true) {
Object obj = selectBuilderImpl._state;
if (obj == this) {
return null;
}
if (obj instanceof OpDescriptor) {
((OpDescriptor) obj).perform(this.impl);
} else if (obj != SelectKt.getNOT_SELECTED()) {
return SelectKt.getALREADY_SELECTED();
} else {
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(SelectBuilderImpl._state$FU, this.impl, SelectKt.getNOT_SELECTED(), this)) {
return null;
}
}
}
}
private final void undoPrepare() {
AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(SelectBuilderImpl._state$FU, this.impl, this, SelectKt.getNOT_SELECTED());
}
private final void completeSelect(Object obj) {
boolean z = obj == null;
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(SelectBuilderImpl._state$FU, this.impl, this, z ? null : SelectKt.getNOT_SELECTED()) && z) {
this.impl.doAfterSelect();
}
}
public String toString() {
return "AtomicSelectOp(sequence=" + getOpSequence() + ')';
}
}
public void invoke(SelectClause0 selectClause0, Function1<? super Continuation<? super R>, ? extends Object> function1) {
selectClause0.registerSelectClause0(this, function1);
}
public <Q> void invoke(SelectClause1<? extends Q> selectClause1, Function2<? super Q, ? super Continuation<? super R>, ? extends Object> function2) {
selectClause1.registerSelectClause1(this, function2);
}
public <P, Q> void invoke(SelectClause2<? super P, ? extends Q> selectClause2, P p, Function2<? super Q, ? super Continuation<? super R>, ? extends Object> function2) {
selectClause2.registerSelectClause2(this, p, function2);
}
public void onTimeout(long j, Function1<? super Continuation<? super R>, ? extends Object> function1) {
if (j > 0) {
disposeOnSelect(DelayKt.getDelay(getContext()).invokeOnTimeout(j, new SelectBuilderImpl$onTimeout$$inlined$Runnable$1(this, function1), getContext()));
} else if (trySelect()) {
UndispatchedKt.startCoroutineUnintercepted(function1, getCompletion());
}
}
@Metadata(d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0002\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004R\u0010\u0010\u0002\u001a\u00020\u00038\u0006X\u0004¢\u0006\u0002\n\u0000¨\u0006\u0005"}, d2 = {"Lkotlinx/coroutines/selects/SelectBuilderImpl$DisposeNode;", "Lkotlinx/coroutines/internal/LockFreeLinkedListNode;", "handle", "Lkotlinx/coroutines/DisposableHandle;", "(Lkotlinx/coroutines/DisposableHandle;)V", "kotlinx-coroutines-core"}, k = 1, mv = {1, 6, 0}, xi = 48)
/* compiled from: Select.kt */
private static final class DisposeNode extends LockFreeLinkedListNode {
public final DisposableHandle handle;
public DisposeNode(DisposableHandle disposableHandle) {
this.handle = disposableHandle;
}
}
public void resumeWith(Object obj) {
if (!DebugKt.getASSERTIONS_ENABLED() || isSelected()) {
while (true) {
Object obj2 = this._result;
if (obj2 == SelectKt.UNDECIDED) {
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_result$FU, this, SelectKt.UNDECIDED, CompletionStateKt.toState$default(obj, (Function1) null, 1, (Object) null))) {
return;
}
} else if (obj2 != IntrinsicsKt.getCOROUTINE_SUSPENDED()) {
throw new IllegalStateException("Already resumed");
} else if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_result$FU, this, IntrinsicsKt.getCOROUTINE_SUSPENDED(), SelectKt.RESUMED)) {
if (Result.m358isFailureimpl(obj)) {
Continuation<R> continuation = this.uCont;
Throwable r4 = Result.m355exceptionOrNullimpl(obj);
Intrinsics.checkNotNull(r4);
Result.Companion companion = Result.Companion;
if (DebugKt.getRECOVER_STACK_TRACES() && (continuation instanceof CoroutineStackFrame)) {
r4 = StackTraceRecoveryKt.recoverFromStackFrame(r4, (CoroutineStackFrame) continuation);
}
continuation.resumeWith(Result.m352constructorimpl(ResultKt.createFailure(r4)));
return;
}
this.uCont.resumeWith(obj);
return;
}
}
} else {
throw new AssertionError();
}
}
public void resumeSelectWithException(Throwable th) {
if (!DebugKt.getASSERTIONS_ENABLED() || isSelected()) {
while (true) {
Object obj = this._result;
if (obj == SelectKt.UNDECIDED) {
Continuation<R> continuation = this.uCont;
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_result$FU, this, SelectKt.UNDECIDED, new CompletedExceptionally((!DebugKt.getRECOVER_STACK_TRACES() || !(continuation instanceof CoroutineStackFrame)) ? th : StackTraceRecoveryKt.recoverFromStackFrame(th, (CoroutineStackFrame) continuation), false, 2, (DefaultConstructorMarker) null))) {
return;
}
} else if (obj != IntrinsicsKt.getCOROUTINE_SUSPENDED()) {
throw new IllegalStateException("Already resumed");
} else if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_result$FU, this, IntrinsicsKt.getCOROUTINE_SUSPENDED(), SelectKt.RESUMED)) {
Continuation<R> intercepted = IntrinsicsKt.intercepted(this.uCont);
Result.Companion companion = Result.Companion;
intercepted.resumeWith(Result.m352constructorimpl(ResultKt.createFailure(th)));
return;
}
}
} else {
throw new AssertionError();
}
}
public boolean isSelected() {
while (true) {
Object obj = this._state;
if (obj == SelectKt.getNOT_SELECTED()) {
return false;
}
if (!(obj instanceof OpDescriptor)) {
return true;
}
((OpDescriptor) obj).perform(this);
}
}
public Object trySelectOther(LockFreeLinkedListNode.PrepareOp prepareOp) {
while (true) {
Object obj = this._state;
if (obj == SelectKt.getNOT_SELECTED()) {
if (prepareOp == null) {
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_state$FU, this, SelectKt.getNOT_SELECTED(), (Object) null)) {
break;
}
} else {
PairSelectOp pairSelectOp = new PairSelectOp(prepareOp);
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_state$FU, this, SelectKt.getNOT_SELECTED(), pairSelectOp)) {
Object perform = pairSelectOp.perform(this);
if (perform != null) {
return perform;
}
}
}
} else if (obj instanceof OpDescriptor) {
if (prepareOp != null) {
AtomicOp<?> atomicOp = prepareOp.getAtomicOp();
if ((atomicOp instanceof AtomicSelectOp) && ((AtomicSelectOp) atomicOp).impl == this) {
throw new IllegalStateException("Cannot use matching select clauses on the same object".toString());
} else if (atomicOp.isEarlierThan((OpDescriptor) obj)) {
return AtomicKt.RETRY_ATOMIC;
}
}
((OpDescriptor) obj).perform(this);
} else if (prepareOp != null && obj == prepareOp.desc) {
return CancellableContinuationImplKt.RESUME_TOKEN;
} else {
return null;
}
}
doAfterSelect();
return CancellableContinuationImplKt.RESUME_TOKEN;
}
}
Download file