708 lines
43 KiB
Java
708 lines
43 KiB
Java
package kotlinx.coroutines;
|
|
|
|
import com.google.android.gms.measurement.api.AppMeasurementSdk;
|
|
import com.google.firebase.analytics.FirebaseAnalytics;
|
|
import com.google.firebase.remoteconfig.RemoteConfigConstants;
|
|
import java.util.concurrent.CancellationException;
|
|
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
|
|
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
|
|
import kotlin.KotlinNothingValueException;
|
|
import kotlin.Metadata;
|
|
import kotlin.PublishedApi;
|
|
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.JvmName;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.jvm.internal.SourceDebugExtension;
|
|
import kotlinx.coroutines.Job;
|
|
import kotlinx.coroutines.internal.DispatchedContinuation;
|
|
import kotlinx.coroutines.internal.Segment;
|
|
import kotlinx.coroutines.internal.Symbol;
|
|
|
|
@Metadata(d1 = {"\u0000È\u0001\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0000\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0002\b\n\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\u0001\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0003\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\u0004\n\u0002\u0018\u0002\n\u0002\b\u000e\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0017\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0011\u0018\u0000*\u0006\b\u0000\u0010\u0001 \u00002\b\u0012\u0004\u0012\u0002H\u00010\u00022\b\u0012\u0004\u0012\u0002H\u00010\u00032\u00060\u0004j\u0002`\u00052\u00020\u0006B\u001b\u0012\f\u0010\u0007\u001a\b\u0012\u0004\u0012\u00028\u00000\b\u0012\u0006\u0010\t\u001a\u00020\n¢\u0006\u0002\u0010\u000bJ\u0012\u0010+\u001a\u00020,2\b\u0010-\u001a\u0004\u0018\u00010\u0012H\u0002J\u0018\u0010.\u001a\u00020/2\u0006\u00100\u001a\u0002012\b\u00102\u001a\u0004\u0018\u000103J;\u0010.\u001a\u00020/2'\u00100\u001a#\u0012\u0015\u0012\u0013\u0018\u000103¢\u0006\f\b5\u0012\b\b6\u0012\u0004\b\b(2\u0012\u0004\u0012\u00020/04j\u0002`72\b\u00102\u001a\u0004\u0018\u000103H\u0002J\u0017\u00108\u001a\u00020/2\f\u00109\u001a\b\u0012\u0004\u0012\u00020/0:H\u0082\bJ1\u0010;\u001a\u00020/2!\u0010<\u001a\u001d\u0012\u0013\u0012\u001103¢\u0006\f\b5\u0012\b\b6\u0012\u0004\b\b(2\u0012\u0004\u0012\u00020/042\u0006\u00102\u001a\u000203J\u001e\u0010=\u001a\u00020/2\n\u0010>\u001a\u0006\u0012\u0002\b\u00030?2\b\u00102\u001a\u0004\u0018\u000103H\u0002J\u0012\u0010@\u001a\u00020\u001d2\b\u00102\u001a\u0004\u0018\u000103H\u0016J\u001f\u0010A\u001a\u00020/2\b\u0010B\u001a\u0004\u0018\u00010\u00122\u0006\u00102\u001a\u000203H\u0010¢\u0006\u0002\bCJ\u0010\u0010D\u001a\u00020\u001d2\u0006\u00102\u001a\u000203H\u0002J\u0010\u0010E\u001a\u00020/2\u0006\u0010F\u001a\u00020\u0012H\u0016J\r\u0010G\u001a\u00020/H\u0000¢\u0006\u0002\bHJ\b\u0010I\u001a\u00020/H\u0002J\u0010\u0010J\u001a\u00020/2\u0006\u0010K\u001a\u00020\nH\u0002J\u0010\u0010L\u001a\u0002032\u0006\u0010M\u001a\u00020NH\u0016J\u0019\u0010O\u001a\u0004\u0018\u0001032\b\u0010$\u001a\u0004\u0018\u00010\u0012H\u0010¢\u0006\u0002\bPJ\n\u0010Q\u001a\u0004\u0018\u00010\u0012H\u0001J\u0010\u0010R\u001a\n\u0018\u00010Sj\u0004\u0018\u0001`TH\u0016J\u001f\u0010U\u001a\u0002H\u0001\"\u0004\b\u0001\u0010\u00012\b\u0010$\u001a\u0004\u0018\u00010\u0012H\u0010¢\u0006\u0004\bV\u0010WJ\b\u0010X\u001a\u00020/H\u0016J\n\u0010Y\u001a\u0004\u0018\u00010\u0010H\u0002J1\u0010Z\u001a\u00020/2'\u00100\u001a#\u0012\u0015\u0012\u0013\u0018\u000103¢\u0006\f\b5\u0012\b\b6\u0012\u0004\b\b(2\u0012\u0004\u0012\u00020/04j\u0002`7H\u0016J\u001c\u0010Z\u001a\u00020/2\n\u0010>\u001a\u0006\u0012\u0002\b\u00030?2\u0006\u0010[\u001a\u00020\nH\u0016J\u0010\u0010\\\u001a\u00020/2\u0006\u00100\u001a\u00020\u0012H\u0002J\b\u0010]\u001a\u00020\u001dH\u0002J1\u0010^\u001a\u0002012'\u00100\u001a#\u0012\u0015\u0012\u0013\u0018\u000103¢\u0006\f\b5\u0012\b\b6\u0012\u0004\b\b(2\u0012\u0004\u0012\u00020/04j\u0002`7H\u0002J\u001a\u0010_\u001a\u00020/2\u0006\u00100\u001a\u00020\u00122\b\u0010$\u001a\u0004\u0018\u00010\u0012H\u0002J\b\u0010`\u001a\u00020(H\u0014J\u0015\u0010a\u001a\u00020/2\u0006\u00102\u001a\u000203H\u0000¢\u0006\u0002\bbJ\r\u0010c\u001a\u00020/H\u0000¢\u0006\u0002\bdJ\b\u0010e\u001a\u00020\u001dH\u0001J:\u0010f\u001a\u00020/2\u0006\u0010g\u001a\u00028\u00002#\u0010<\u001a\u001f\u0012\u0013\u0012\u001103¢\u0006\f\b5\u0012\b\b6\u0012\u0004\b\b(2\u0012\u0004\u0012\u00020/\u0018\u000104H\u0016¢\u0006\u0002\u0010hJA\u0010i\u001a\u00020/2\b\u0010-\u001a\u0004\u0018\u00010\u00122\u0006\u0010\t\u001a\u00020\n2%\b\u0002\u0010<\u001a\u001f\u0012\u0013\u0012\u001103¢\u0006\f\b5\u0012\b\b6\u0012\u0004\b\b(2\u0012\u0004\u0012\u00020/\u0018\u000104H\u0002J\u001b\u0010j\u001a\u00020/2\f\u0010k\u001a\b\u0012\u0004\u0012\u00028\u00000lH\u0016¢\u0006\u0002\u0010mJS\u0010n\u001a\u0004\u0018\u00010\u00122\u0006\u0010$\u001a\u00020o2\b\u0010-\u001a\u0004\u0018\u00010\u00122\u0006\u0010\t\u001a\u00020\n2#\u0010<\u001a\u001f\u0012\u0013\u0012\u001103¢\u0006\f\b5\u0012\b\b6\u0012\u0004\b\b(2\u0012\u0004\u0012\u00020/\u0018\u0001042\b\u0010p\u001a\u0004\u0018\u00010\u0012H\u0002J\u000f\u0010q\u001a\u0004\u0018\u00010\u0012H\u0010¢\u0006\u0002\brJ\b\u0010s\u001a\u00020(H\u0016J\b\u0010t\u001a\u00020\u001dH\u0002J!\u0010t\u001a\u0004\u0018\u00010\u00122\u0006\u0010g\u001a\u00028\u00002\b\u0010p\u001a\u0004\u0018\u00010\u0012H\u0016¢\u0006\u0002\u0010uJF\u0010t\u001a\u0004\u0018\u00010\u00122\u0006\u0010g\u001a\u00028\u00002\b\u0010p\u001a\u0004\u0018\u00010\u00122#\u0010<\u001a\u001f\u0012\u0013\u0012\u001103¢\u0006\f\b5\u0012\b\b6\u0012\u0004\b\b(2\u0012\u0004\u0012\u00020/\u0018\u000104H\u0016¢\u0006\u0002\u0010vJC\u0010w\u001a\u0004\u0018\u00010x2\b\u0010-\u001a\u0004\u0018\u00010\u00122\b\u0010p\u001a\u0004\u0018\u00010\u00122#\u0010<\u001a\u001f\u0012\u0013\u0012\u001103¢\u0006\f\b5\u0012\b\b6\u0012\u0004\b\b(2\u0012\u0004\u0012\u00020/\u0018\u000104H\u0002J\u0012\u0010y\u001a\u0004\u0018\u00010\u00122\u0006\u0010z\u001a\u000203H\u0016J\b\u0010{\u001a\u00020\u001dH\u0002J\u0019\u0010|\u001a\u00020/*\u00020}2\u0006\u0010g\u001a\u00028\u0000H\u0016¢\u0006\u0002\u0010~J\u0014\u0010\u007f\u001a\u00020/*\u00020}2\u0006\u0010z\u001a\u000203H\u0016R\t\u0010\f\u001a\u00020\rX\u0082\u0004R\u0011\u0010\u000e\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00100\u000fX\u0082\u0004R\u0011\u0010\u0011\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00120\u000fX\u0082\u0004R\u001c\u0010\u0013\u001a\n\u0018\u00010\u0004j\u0004\u0018\u0001`\u00058VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u0014\u0010\u0015R\u0014\u0010\u0016\u001a\u00020\u0017X\u0096\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0018\u0010\u0019R\u001a\u0010\u0007\u001a\b\u0012\u0004\u0012\u00028\u00000\bX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u001a\u0010\u001bR\u0014\u0010\u001c\u001a\u00020\u001d8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u001c\u0010\u001eR\u0014\u0010\u001f\u001a\u00020\u001d8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u001f\u0010\u001eR\u0014\u0010 \u001a\u00020\u001d8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b \u0010\u001eR\u0016\u0010!\u001a\u0004\u0018\u00010\u00108BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\"\u0010#R\u0016\u0010$\u001a\u0004\u0018\u00010\u00128@X\u0080\u0004¢\u0006\u0006\u001a\u0004\b%\u0010&R\u0014\u0010'\u001a\u00020(8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b)\u0010*¨\u0006\u0080\u0001"}, d2 = {"Lkotlinx/coroutines/CancellableContinuationImpl;", "T", "Lkotlinx/coroutines/DispatchedTask;", "Lkotlinx/coroutines/CancellableContinuation;", "Lkotlin/coroutines/jvm/internal/CoroutineStackFrame;", "Lkotlinx/coroutines/internal/CoroutineStackFrame;", "Lkotlinx/coroutines/Waiter;", "delegate", "Lkotlin/coroutines/Continuation;", "resumeMode", "", "(Lkotlin/coroutines/Continuation;I)V", "_decisionAndIndex", "Lkotlinx/atomicfu/AtomicInt;", "_parentHandle", "Lkotlinx/atomicfu/AtomicRef;", "Lkotlinx/coroutines/DisposableHandle;", "_state", "", "callerFrame", "getCallerFrame", "()Lkotlin/coroutines/jvm/internal/CoroutineStackFrame;", "context", "Lkotlin/coroutines/CoroutineContext;", "getContext", "()Lkotlin/coroutines/CoroutineContext;", "getDelegate$kotlinx_coroutines_core", "()Lkotlin/coroutines/Continuation;", "isActive", "", "()Z", "isCancelled", "isCompleted", "parentHandle", "getParentHandle", "()Lkotlinx/coroutines/DisposableHandle;", RemoteConfigConstants.ResponseFieldKey.STATE, "getState$kotlinx_coroutines_core", "()Ljava/lang/Object;", "stateDebugRepresentation", "", "getStateDebugRepresentation", "()Ljava/lang/String;", "alreadyResumedError", "", "proposedUpdate", "callCancelHandler", "", "handler", "Lkotlinx/coroutines/CancelHandler;", "cause", "", "Lkotlin/Function1;", "Lkotlin/ParameterName;", AppMeasurementSdk.ConditionalUserProperty.NAME, "Lkotlinx/coroutines/CompletionHandler;", "callCancelHandlerSafely", "block", "Lkotlin/Function0;", "callOnCancellation", "onCancellation", "callSegmentOnCancellation", "segment", "Lkotlinx/coroutines/internal/Segment;", "cancel", "cancelCompletedResult", "takenState", "cancelCompletedResult$kotlinx_coroutines_core", "cancelLater", "completeResume", "token", "detachChild", "detachChild$kotlinx_coroutines_core", "detachChildIfNonResuable", "dispatchResume", "mode", "getContinuationCancellationCause", "parent", "Lkotlinx/coroutines/Job;", "getExceptionalResult", "getExceptionalResult$kotlinx_coroutines_core", "getResult", "getStackTraceElement", "Ljava/lang/StackTraceElement;", "Lkotlinx/coroutines/internal/StackTraceElement;", "getSuccessfulResult", "getSuccessfulResult$kotlinx_coroutines_core", "(Ljava/lang/Object;)Ljava/lang/Object;", "initCancellability", "installParentHandle", "invokeOnCancellation", FirebaseAnalytics.Param.INDEX, "invokeOnCancellationImpl", "isReusable", "makeCancelHandler", "multipleHandlersError", "nameString", "parentCancelled", "parentCancelled$kotlinx_coroutines_core", "releaseClaimedReusableContinuation", "releaseClaimedReusableContinuation$kotlinx_coroutines_core", "resetStateReusable", "resume", "value", "(Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)V", "resumeImpl", "resumeWith", "result", "Lkotlin/Result;", "(Ljava/lang/Object;)V", "resumedState", "Lkotlinx/coroutines/NotCompleted;", "idempotent", "takeState", "takeState$kotlinx_coroutines_core", "toString", "tryResume", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", "(Ljava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;", "tryResumeImpl", "Lkotlinx/coroutines/internal/Symbol;", "tryResumeWithException", "exception", "trySuspend", "resumeUndispatched", "Lkotlinx/coroutines/CoroutineDispatcher;", "(Lkotlinx/coroutines/CoroutineDispatcher;Ljava/lang/Object;)V", "resumeUndispatchedWithException", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
|
@PublishedApi
|
|
@SourceDebugExtension({"SMAP\nCancellableContinuationImpl.kt\nKotlin\n*S Kotlin\n*F\n+ 1 CancellableContinuationImpl.kt\nkotlinx/coroutines/CancellableContinuationImpl\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 3 CancellableContinuationImpl.kt\nkotlinx/coroutines/CancellableContinuationImplKt\n+ 4 CompletionHandler.kt\nkotlinx/coroutines/CompletionHandlerKt\n+ 5 StackTraceRecovery.kt\nkotlinx/coroutines/internal/StackTraceRecoveryKt\n*L\n1#1,662:1\n230#1,2:666\n232#1,8:669\n230#1,10:677\n230#1,10:688\n1#2:663\n24#3:664\n24#3:665\n22#3:687\n21#3:698\n22#3,3:699\n21#3:702\n22#3,3:703\n22#3:711\n21#3,4:712\n22#4:668\n13#4:710\n61#5,2:706\n61#5,2:708\n61#5,2:716\n*S KotlinDebug\n*F\n+ 1 CancellableContinuationImpl.kt\nkotlinx/coroutines/CancellableContinuationImpl\n*L\n246#1:666,2\n246#1:669,8\n249#1:677,10\n254#1:688,10\n72#1:664\n158#1:665\n252#1:687\n277#1:698\n278#1:699,3\n287#1:702\n288#1:703,3\n389#1:711\n392#1:712,4\n246#1:668\n350#1:710\n329#1:706,2\n339#1:708,2\n613#1:716,2\n*E\n"})
|
|
/* loaded from: classes3.dex */
|
|
public class CancellableContinuationImpl<T> extends DispatchedTask<T> implements CancellableContinuation<T>, CoroutineStackFrame, Waiter {
|
|
private volatile /* synthetic */ int _decisionAndIndex$volatile;
|
|
private volatile /* synthetic */ Object _parentHandle$volatile;
|
|
private volatile /* synthetic */ Object _state$volatile;
|
|
private final CoroutineContext context;
|
|
private final Continuation<T> delegate;
|
|
private static final /* synthetic */ AtomicIntegerFieldUpdater _decisionAndIndex$volatile$FU = AtomicIntegerFieldUpdater.newUpdater(CancellableContinuationImpl.class, "_decisionAndIndex$volatile");
|
|
private static final /* synthetic */ AtomicReferenceFieldUpdater _state$volatile$FU = AtomicReferenceFieldUpdater.newUpdater(CancellableContinuationImpl.class, Object.class, "_state$volatile");
|
|
private static final /* synthetic */ AtomicReferenceFieldUpdater _parentHandle$volatile$FU = AtomicReferenceFieldUpdater.newUpdater(CancellableContinuationImpl.class, Object.class, "_parentHandle$volatile");
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public CancellableContinuationImpl(Continuation<? super T> continuation, int i) {
|
|
super(i);
|
|
this.delegate = continuation;
|
|
this.context = continuation.get$context();
|
|
this._decisionAndIndex$volatile = 536870911;
|
|
this._state$volatile = Active.INSTANCE;
|
|
}
|
|
|
|
private final Void alreadyResumedError(Object proposedUpdate) {
|
|
throw new IllegalStateException(("Already resumed, but proposed with update " + proposedUpdate).toString());
|
|
}
|
|
|
|
private final void callCancelHandlerSafely(Function0<Unit> block) {
|
|
try {
|
|
block.invoke();
|
|
} catch (Throwable th) {
|
|
CoroutineExceptionHandlerKt.handleCoroutineException(get$context(), new CompletionHandlerException("Exception in invokeOnCancellation handler for " + this, th));
|
|
}
|
|
}
|
|
|
|
private final void callSegmentOnCancellation(Segment<?> segment, Throwable cause) {
|
|
int i = _decisionAndIndex$volatile$FU.get(this) & 536870911;
|
|
if (i == 536870911) {
|
|
throw new IllegalStateException("The index for Segment.onCancellation(..) is broken");
|
|
}
|
|
try {
|
|
segment.onCancellation(i, cause, get$context());
|
|
} catch (Throwable th) {
|
|
CoroutineExceptionHandlerKt.handleCoroutineException(get$context(), new CompletionHandlerException("Exception in invokeOnCancellation handler for " + this, th));
|
|
}
|
|
}
|
|
|
|
private final boolean cancelLater(Throwable cause) {
|
|
if (!isReusable()) {
|
|
return false;
|
|
}
|
|
Continuation<T> continuation = this.delegate;
|
|
Intrinsics.checkNotNull(continuation, "null cannot be cast to non-null type kotlinx.coroutines.internal.DispatchedContinuation<*>");
|
|
return ((DispatchedContinuation) continuation).postponeCancellation$kotlinx_coroutines_core(cause);
|
|
}
|
|
|
|
private final void detachChildIfNonResuable() {
|
|
if (isReusable()) {
|
|
return;
|
|
}
|
|
detachChild$kotlinx_coroutines_core();
|
|
}
|
|
|
|
private final void dispatchResume(int mode) {
|
|
if (tryResume()) {
|
|
return;
|
|
}
|
|
DispatchedTaskKt.dispatch(this, mode);
|
|
}
|
|
|
|
private final DisposableHandle getParentHandle() {
|
|
return (DisposableHandle) _parentHandle$volatile$FU.get(this);
|
|
}
|
|
|
|
private final String getStateDebugRepresentation() {
|
|
Object state$kotlinx_coroutines_core = getState$kotlinx_coroutines_core();
|
|
return state$kotlinx_coroutines_core instanceof NotCompleted ? "Active" : state$kotlinx_coroutines_core instanceof CancelledContinuation ? "Cancelled" : "Completed";
|
|
}
|
|
|
|
private final /* synthetic */ int get_decisionAndIndex$volatile() {
|
|
return this._decisionAndIndex$volatile;
|
|
}
|
|
|
|
private final /* synthetic */ Object get_parentHandle$volatile() {
|
|
return this._parentHandle$volatile;
|
|
}
|
|
|
|
private final /* synthetic */ Object get_state$volatile() {
|
|
return this._state$volatile;
|
|
}
|
|
|
|
private final DisposableHandle installParentHandle() {
|
|
Job job = (Job) get$context().get(Job.INSTANCE);
|
|
if (job == null) {
|
|
return null;
|
|
}
|
|
DisposableHandle invokeOnCompletion$default = Job.DefaultImpls.invokeOnCompletion$default(job, true, false, new ChildContinuation(this), 2, null);
|
|
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _parentHandle$volatile$FU;
|
|
while (!atomicReferenceFieldUpdater.compareAndSet(this, null, invokeOnCompletion$default) && atomicReferenceFieldUpdater.get(this) == null) {
|
|
}
|
|
return invokeOnCompletion$default;
|
|
}
|
|
|
|
private final void invokeOnCancellationImpl(Object handler) {
|
|
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _state$volatile$FU;
|
|
while (true) {
|
|
Object obj = atomicReferenceFieldUpdater.get(this);
|
|
if (obj instanceof Active) {
|
|
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater2 = _state$volatile$FU;
|
|
while (!atomicReferenceFieldUpdater2.compareAndSet(this, obj, handler)) {
|
|
if (atomicReferenceFieldUpdater2.get(this) != obj) {
|
|
break;
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
boolean z3 = true;
|
|
if (obj instanceof CancelHandler ? true : obj instanceof Segment) {
|
|
multipleHandlersError(handler, obj);
|
|
} else {
|
|
if (obj instanceof CompletedExceptionally) {
|
|
CompletedExceptionally completedExceptionally = (CompletedExceptionally) obj;
|
|
if (!completedExceptionally.makeHandled()) {
|
|
multipleHandlersError(handler, obj);
|
|
}
|
|
if (obj instanceof CancelledContinuation) {
|
|
if (!(obj instanceof CompletedExceptionally)) {
|
|
completedExceptionally = null;
|
|
}
|
|
Throwable th = completedExceptionally != null ? completedExceptionally.cause : null;
|
|
if (handler instanceof CancelHandler) {
|
|
callCancelHandler((CancelHandler) handler, th);
|
|
return;
|
|
} else {
|
|
Intrinsics.checkNotNull(handler, "null cannot be cast to non-null type kotlinx.coroutines.internal.Segment<*>");
|
|
callSegmentOnCancellation((Segment) handler, th);
|
|
return;
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
if (obj instanceof CompletedContinuation) {
|
|
CompletedContinuation completedContinuation = (CompletedContinuation) obj;
|
|
if (completedContinuation.cancelHandler != null) {
|
|
multipleHandlersError(handler, obj);
|
|
}
|
|
if (handler instanceof Segment) {
|
|
return;
|
|
}
|
|
Intrinsics.checkNotNull(handler, "null cannot be cast to non-null type kotlinx.coroutines.CancelHandler");
|
|
CancelHandler cancelHandler = (CancelHandler) handler;
|
|
if (completedContinuation.getCancelled()) {
|
|
callCancelHandler(cancelHandler, completedContinuation.cancelCause);
|
|
return;
|
|
}
|
|
CompletedContinuation copy$default = CompletedContinuation.copy$default(completedContinuation, null, cancelHandler, null, null, null, 29, null);
|
|
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater3 = _state$volatile$FU;
|
|
while (true) {
|
|
if (atomicReferenceFieldUpdater3.compareAndSet(this, obj, copy$default)) {
|
|
break;
|
|
} else if (atomicReferenceFieldUpdater3.get(this) != obj) {
|
|
z3 = false;
|
|
break;
|
|
}
|
|
}
|
|
if (z3) {
|
|
return;
|
|
}
|
|
} else {
|
|
if (handler instanceof Segment) {
|
|
return;
|
|
}
|
|
Intrinsics.checkNotNull(handler, "null cannot be cast to non-null type kotlinx.coroutines.CancelHandler");
|
|
CompletedContinuation completedContinuation2 = new CompletedContinuation(obj, (CancelHandler) handler, null, null, null, 28, null);
|
|
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater4 = _state$volatile$FU;
|
|
while (true) {
|
|
if (atomicReferenceFieldUpdater4.compareAndSet(this, obj, completedContinuation2)) {
|
|
break;
|
|
} else if (atomicReferenceFieldUpdater4.get(this) != obj) {
|
|
z3 = false;
|
|
break;
|
|
}
|
|
}
|
|
if (z3) {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private final boolean isReusable() {
|
|
if (!DispatchedTaskKt.isReusableMode(this.resumeMode)) {
|
|
return false;
|
|
}
|
|
Continuation<T> continuation = this.delegate;
|
|
Intrinsics.checkNotNull(continuation, "null cannot be cast to non-null type kotlinx.coroutines.internal.DispatchedContinuation<*>");
|
|
return ((DispatchedContinuation) continuation).isReusable$kotlinx_coroutines_core();
|
|
}
|
|
|
|
private final /* synthetic */ void loop$atomicfu(Object obj, AtomicIntegerFieldUpdater atomicIntegerFieldUpdater, Function1<? super Integer, Unit> function1) {
|
|
while (true) {
|
|
function1.invoke(Integer.valueOf(atomicIntegerFieldUpdater.get(obj)));
|
|
}
|
|
}
|
|
|
|
private final CancelHandler makeCancelHandler(Function1<? super Throwable, Unit> handler) {
|
|
return handler instanceof CancelHandler ? (CancelHandler) handler : new InvokeOnCancel(handler);
|
|
}
|
|
|
|
private final void multipleHandlersError(Object handler, Object state) {
|
|
throw new IllegalStateException(("It's prohibited to register multiple handlers, tried to register " + handler + ", already has " + state).toString());
|
|
}
|
|
|
|
private final void resumeImpl(Object proposedUpdate, int resumeMode, Function1<? super Throwable, Unit> onCancellation) {
|
|
CancellableContinuationImpl<T> cancellableContinuationImpl;
|
|
Object obj;
|
|
int i;
|
|
Function1<? super Throwable, Unit> function1;
|
|
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _state$volatile$FU;
|
|
while (true) {
|
|
Object obj2 = atomicReferenceFieldUpdater.get(this);
|
|
if (obj2 instanceof NotCompleted) {
|
|
cancellableContinuationImpl = this;
|
|
obj = proposedUpdate;
|
|
i = resumeMode;
|
|
function1 = onCancellation;
|
|
Object resumedState = cancellableContinuationImpl.resumedState((NotCompleted) obj2, obj, i, function1, null);
|
|
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater2 = _state$volatile$FU;
|
|
while (!atomicReferenceFieldUpdater2.compareAndSet(cancellableContinuationImpl, obj2, resumedState)) {
|
|
if (atomicReferenceFieldUpdater2.get(cancellableContinuationImpl) != obj2) {
|
|
break;
|
|
}
|
|
}
|
|
cancellableContinuationImpl.detachChildIfNonResuable();
|
|
cancellableContinuationImpl.dispatchResume(i);
|
|
return;
|
|
}
|
|
CancellableContinuationImpl<T> cancellableContinuationImpl2 = this;
|
|
Object obj3 = proposedUpdate;
|
|
Function1<? super Throwable, Unit> function12 = onCancellation;
|
|
if (obj2 instanceof CancelledContinuation) {
|
|
CancelledContinuation cancelledContinuation = (CancelledContinuation) obj2;
|
|
if (cancelledContinuation.makeResumed()) {
|
|
if (function12 != null) {
|
|
cancellableContinuationImpl2.callOnCancellation(function12, cancelledContinuation.cause);
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
cancellableContinuationImpl2.alreadyResumedError(obj3);
|
|
throw new KotlinNothingValueException();
|
|
this = cancellableContinuationImpl;
|
|
proposedUpdate = obj;
|
|
resumeMode = i;
|
|
onCancellation = function1;
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static /* synthetic */ void resumeImpl$default(CancellableContinuationImpl cancellableContinuationImpl, Object obj, int i, Function1 function1, int i4, Object obj2) {
|
|
if (obj2 != null) {
|
|
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: resumeImpl");
|
|
}
|
|
if ((i4 & 4) != 0) {
|
|
function1 = null;
|
|
}
|
|
cancellableContinuationImpl.resumeImpl(obj, i, function1);
|
|
}
|
|
|
|
private final Object resumedState(NotCompleted state, Object proposedUpdate, int resumeMode, Function1<? super Throwable, Unit> onCancellation, Object idempotent) {
|
|
if (proposedUpdate instanceof CompletedExceptionally) {
|
|
return proposedUpdate;
|
|
}
|
|
if ((DispatchedTaskKt.isCancellableMode(resumeMode) || idempotent != null) && !(onCancellation == null && !(state instanceof CancelHandler) && idempotent == null)) {
|
|
return new CompletedContinuation(proposedUpdate, state instanceof CancelHandler ? (CancelHandler) state : null, onCancellation, idempotent, null, 16, null);
|
|
}
|
|
return proposedUpdate;
|
|
}
|
|
|
|
private final /* synthetic */ void set_decisionAndIndex$volatile(int i) {
|
|
this._decisionAndIndex$volatile = i;
|
|
}
|
|
|
|
private final /* synthetic */ void set_parentHandle$volatile(Object obj) {
|
|
this._parentHandle$volatile = obj;
|
|
}
|
|
|
|
private final /* synthetic */ void set_state$volatile(Object obj) {
|
|
this._state$volatile = obj;
|
|
}
|
|
|
|
private final boolean tryResume() {
|
|
int i;
|
|
AtomicIntegerFieldUpdater atomicIntegerFieldUpdater = _decisionAndIndex$volatile$FU;
|
|
do {
|
|
i = atomicIntegerFieldUpdater.get(this);
|
|
int i4 = i >> 29;
|
|
if (i4 != 0) {
|
|
if (i4 == 1) {
|
|
return false;
|
|
}
|
|
throw new IllegalStateException("Already resumed");
|
|
}
|
|
} while (!_decisionAndIndex$volatile$FU.compareAndSet(this, i, 1073741824 + (536870911 & i)));
|
|
return true;
|
|
}
|
|
|
|
private final Symbol tryResumeImpl(Object proposedUpdate, Object idempotent, Function1<? super Throwable, Unit> onCancellation) {
|
|
CancellableContinuationImpl<T> cancellableContinuationImpl;
|
|
Object obj;
|
|
Object obj2;
|
|
Function1<? super Throwable, Unit> function1;
|
|
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _state$volatile$FU;
|
|
while (true) {
|
|
Object obj3 = atomicReferenceFieldUpdater.get(this);
|
|
if (!(obj3 instanceof NotCompleted)) {
|
|
Object obj4 = idempotent;
|
|
if ((obj3 instanceof CompletedContinuation) && obj4 != null && ((CompletedContinuation) obj3).idempotentResume == obj4) {
|
|
return CancellableContinuationImplKt.RESUME_TOKEN;
|
|
}
|
|
return null;
|
|
}
|
|
cancellableContinuationImpl = this;
|
|
obj = proposedUpdate;
|
|
obj2 = idempotent;
|
|
function1 = onCancellation;
|
|
Object resumedState = cancellableContinuationImpl.resumedState((NotCompleted) obj3, obj, this.resumeMode, function1, obj2);
|
|
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater2 = _state$volatile$FU;
|
|
while (!atomicReferenceFieldUpdater2.compareAndSet(cancellableContinuationImpl, obj3, resumedState)) {
|
|
if (atomicReferenceFieldUpdater2.get(cancellableContinuationImpl) != obj3) {
|
|
break;
|
|
}
|
|
}
|
|
cancellableContinuationImpl.detachChildIfNonResuable();
|
|
return CancellableContinuationImplKt.RESUME_TOKEN;
|
|
this = cancellableContinuationImpl;
|
|
proposedUpdate = obj;
|
|
onCancellation = function1;
|
|
idempotent = obj2;
|
|
}
|
|
}
|
|
|
|
private final boolean trySuspend() {
|
|
int i;
|
|
AtomicIntegerFieldUpdater atomicIntegerFieldUpdater = _decisionAndIndex$volatile$FU;
|
|
do {
|
|
i = atomicIntegerFieldUpdater.get(this);
|
|
int i4 = i >> 29;
|
|
if (i4 != 0) {
|
|
if (i4 == 2) {
|
|
return false;
|
|
}
|
|
throw new IllegalStateException("Already suspended");
|
|
}
|
|
} while (!_decisionAndIndex$volatile$FU.compareAndSet(this, i, 536870912 + (536870911 & i)));
|
|
return true;
|
|
}
|
|
|
|
private final /* synthetic */ void update$atomicfu(Object obj, AtomicIntegerFieldUpdater atomicIntegerFieldUpdater, Function1<? super Integer, Integer> function1) {
|
|
int i;
|
|
do {
|
|
i = atomicIntegerFieldUpdater.get(obj);
|
|
} while (!atomicIntegerFieldUpdater.compareAndSet(obj, i, function1.invoke(Integer.valueOf(i)).intValue()));
|
|
}
|
|
|
|
public final void callCancelHandler(CancelHandler handler, Throwable cause) {
|
|
try {
|
|
handler.invoke(cause);
|
|
} catch (Throwable th) {
|
|
CoroutineExceptionHandlerKt.handleCoroutineException(get$context(), new CompletionHandlerException("Exception in invokeOnCancellation handler for " + this, th));
|
|
}
|
|
}
|
|
|
|
public final void callOnCancellation(Function1<? super Throwable, Unit> onCancellation, Throwable cause) {
|
|
try {
|
|
onCancellation.invoke(cause);
|
|
} catch (Throwable th) {
|
|
CoroutineExceptionHandlerKt.handleCoroutineException(get$context(), new CompletionHandlerException("Exception in resume onCancellation handler for " + this, th));
|
|
}
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.CancellableContinuation
|
|
public boolean cancel(Throwable cause) {
|
|
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _state$volatile$FU;
|
|
while (true) {
|
|
Object obj = atomicReferenceFieldUpdater.get(this);
|
|
if (!(obj instanceof NotCompleted)) {
|
|
return false;
|
|
}
|
|
CancelledContinuation cancelledContinuation = new CancelledContinuation(this, cause, (obj instanceof CancelHandler) || (obj instanceof Segment));
|
|
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater2 = _state$volatile$FU;
|
|
while (!atomicReferenceFieldUpdater2.compareAndSet(this, obj, cancelledContinuation)) {
|
|
if (atomicReferenceFieldUpdater2.get(this) != obj) {
|
|
break;
|
|
}
|
|
}
|
|
NotCompleted notCompleted = (NotCompleted) obj;
|
|
if (notCompleted instanceof CancelHandler) {
|
|
callCancelHandler((CancelHandler) obj, cause);
|
|
} else if (notCompleted instanceof Segment) {
|
|
callSegmentOnCancellation((Segment) obj, cause);
|
|
}
|
|
detachChildIfNonResuable();
|
|
dispatchResume(this.resumeMode);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.DispatchedTask
|
|
public void cancelCompletedResult$kotlinx_coroutines_core(Object takenState, Throwable cause) {
|
|
Throwable th;
|
|
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _state$volatile$FU;
|
|
while (true) {
|
|
Object obj = atomicReferenceFieldUpdater.get(this);
|
|
if (obj instanceof NotCompleted) {
|
|
throw new IllegalStateException("Not completed");
|
|
}
|
|
if (obj instanceof CompletedExceptionally) {
|
|
return;
|
|
}
|
|
if (!(obj instanceof CompletedContinuation)) {
|
|
th = cause;
|
|
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater2 = _state$volatile$FU;
|
|
CompletedContinuation completedContinuation = new CompletedContinuation(obj, null, null, null, th, 14, null);
|
|
while (!atomicReferenceFieldUpdater2.compareAndSet(this, obj, completedContinuation)) {
|
|
if (atomicReferenceFieldUpdater2.get(this) != obj) {
|
|
break;
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
CompletedContinuation completedContinuation2 = (CompletedContinuation) obj;
|
|
if (completedContinuation2.getCancelled()) {
|
|
throw new IllegalStateException("Must be called at most once");
|
|
}
|
|
Throwable th2 = cause;
|
|
CompletedContinuation copy$default = CompletedContinuation.copy$default(completedContinuation2, null, null, null, null, th2, 15, null);
|
|
th = th2;
|
|
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater3 = _state$volatile$FU;
|
|
while (!atomicReferenceFieldUpdater3.compareAndSet(this, obj, copy$default)) {
|
|
if (atomicReferenceFieldUpdater3.get(this) != obj) {
|
|
break;
|
|
}
|
|
}
|
|
completedContinuation2.invokeHandlers(this, th);
|
|
return;
|
|
cause = th;
|
|
}
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.CancellableContinuation
|
|
public void completeResume(Object token) {
|
|
dispatchResume(this.resumeMode);
|
|
}
|
|
|
|
public final void detachChild$kotlinx_coroutines_core() {
|
|
DisposableHandle parentHandle = getParentHandle();
|
|
if (parentHandle == null) {
|
|
return;
|
|
}
|
|
parentHandle.dispose();
|
|
_parentHandle$volatile$FU.set(this, NonDisposableHandle.INSTANCE);
|
|
}
|
|
|
|
@Override // kotlin.coroutines.jvm.internal.CoroutineStackFrame
|
|
public CoroutineStackFrame getCallerFrame() {
|
|
Continuation<T> continuation = this.delegate;
|
|
if (continuation instanceof CoroutineStackFrame) {
|
|
return (CoroutineStackFrame) continuation;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@Override // kotlin.coroutines.Continuation
|
|
/* renamed from: getContext, reason: from getter */
|
|
public CoroutineContext get$context() {
|
|
return this.context;
|
|
}
|
|
|
|
public Throwable getContinuationCancellationCause(Job parent) {
|
|
return parent.getCancellationException();
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.DispatchedTask
|
|
public final Continuation<T> getDelegate$kotlinx_coroutines_core() {
|
|
return this.delegate;
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.DispatchedTask
|
|
public Throwable getExceptionalResult$kotlinx_coroutines_core(Object state) {
|
|
Throwable exceptionalResult$kotlinx_coroutines_core = super.getExceptionalResult$kotlinx_coroutines_core(state);
|
|
if (exceptionalResult$kotlinx_coroutines_core != null) {
|
|
return exceptionalResult$kotlinx_coroutines_core;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@PublishedApi
|
|
public final Object getResult() {
|
|
Job job;
|
|
boolean isReusable = isReusable();
|
|
if (trySuspend()) {
|
|
if (getParentHandle() == null) {
|
|
installParentHandle();
|
|
}
|
|
if (isReusable) {
|
|
releaseClaimedReusableContinuation$kotlinx_coroutines_core();
|
|
}
|
|
return IntrinsicsKt.getCOROUTINE_SUSPENDED();
|
|
}
|
|
if (isReusable) {
|
|
releaseClaimedReusableContinuation$kotlinx_coroutines_core();
|
|
}
|
|
Object state$kotlinx_coroutines_core = getState$kotlinx_coroutines_core();
|
|
if (state$kotlinx_coroutines_core instanceof CompletedExceptionally) {
|
|
throw ((CompletedExceptionally) state$kotlinx_coroutines_core).cause;
|
|
}
|
|
if (!DispatchedTaskKt.isCancellableMode(this.resumeMode) || (job = (Job) get$context().get(Job.INSTANCE)) == null || job.isActive()) {
|
|
return getSuccessfulResult$kotlinx_coroutines_core(state$kotlinx_coroutines_core);
|
|
}
|
|
CancellationException cancellationException = job.getCancellationException();
|
|
cancelCompletedResult$kotlinx_coroutines_core(state$kotlinx_coroutines_core, cancellationException);
|
|
throw cancellationException;
|
|
}
|
|
|
|
@Override // kotlin.coroutines.jvm.internal.CoroutineStackFrame
|
|
public StackTraceElement getStackTraceElement() {
|
|
return null;
|
|
}
|
|
|
|
public final Object getState$kotlinx_coroutines_core() {
|
|
return _state$volatile$FU.get(this);
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@Override // kotlinx.coroutines.DispatchedTask
|
|
public <T> T getSuccessfulResult$kotlinx_coroutines_core(Object state) {
|
|
return state instanceof CompletedContinuation ? (T) ((CompletedContinuation) state).result : state;
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.CancellableContinuation
|
|
public void initCancellability() {
|
|
DisposableHandle installParentHandle = installParentHandle();
|
|
if (installParentHandle != null && isCompleted()) {
|
|
installParentHandle.dispose();
|
|
_parentHandle$volatile$FU.set(this, NonDisposableHandle.INSTANCE);
|
|
}
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.Waiter
|
|
public void invokeOnCancellation(Segment<?> segment, int index) {
|
|
int i;
|
|
AtomicIntegerFieldUpdater atomicIntegerFieldUpdater = _decisionAndIndex$volatile$FU;
|
|
do {
|
|
i = atomicIntegerFieldUpdater.get(this);
|
|
if ((i & 536870911) != 536870911) {
|
|
throw new IllegalStateException("invokeOnCancellation should be called at most once");
|
|
}
|
|
} while (!atomicIntegerFieldUpdater.compareAndSet(this, i, ((i >> 29) << 29) + index));
|
|
invokeOnCancellationImpl(segment);
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.CancellableContinuation
|
|
public boolean isActive() {
|
|
return getState$kotlinx_coroutines_core() instanceof NotCompleted;
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.CancellableContinuation
|
|
public boolean isCancelled() {
|
|
return getState$kotlinx_coroutines_core() instanceof CancelledContinuation;
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.CancellableContinuation
|
|
public boolean isCompleted() {
|
|
return !(getState$kotlinx_coroutines_core() instanceof NotCompleted);
|
|
}
|
|
|
|
public String nameString() {
|
|
return "CancellableContinuation";
|
|
}
|
|
|
|
public final void parentCancelled$kotlinx_coroutines_core(Throwable cause) {
|
|
if (cancelLater(cause)) {
|
|
return;
|
|
}
|
|
cancel(cause);
|
|
detachChildIfNonResuable();
|
|
}
|
|
|
|
public final void releaseClaimedReusableContinuation$kotlinx_coroutines_core() {
|
|
Throwable tryReleaseClaimedContinuation$kotlinx_coroutines_core;
|
|
Continuation<T> continuation = this.delegate;
|
|
DispatchedContinuation dispatchedContinuation = continuation instanceof DispatchedContinuation ? (DispatchedContinuation) continuation : null;
|
|
if (dispatchedContinuation == null || (tryReleaseClaimedContinuation$kotlinx_coroutines_core = dispatchedContinuation.tryReleaseClaimedContinuation$kotlinx_coroutines_core(this)) == null) {
|
|
return;
|
|
}
|
|
detachChild$kotlinx_coroutines_core();
|
|
cancel(tryReleaseClaimedContinuation$kotlinx_coroutines_core);
|
|
}
|
|
|
|
@JvmName(name = "resetStateReusable")
|
|
public final boolean resetStateReusable() {
|
|
Object obj = _state$volatile$FU.get(this);
|
|
if ((obj instanceof CompletedContinuation) && ((CompletedContinuation) obj).idempotentResume != null) {
|
|
detachChild$kotlinx_coroutines_core();
|
|
return false;
|
|
}
|
|
_decisionAndIndex$volatile$FU.set(this, 536870911);
|
|
_state$volatile$FU.set(this, Active.INSTANCE);
|
|
return true;
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.CancellableContinuation
|
|
public void resume(T value, Function1<? super Throwable, Unit> onCancellation) {
|
|
resumeImpl(value, this.resumeMode, onCancellation);
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.CancellableContinuation
|
|
public void resumeUndispatched(CoroutineDispatcher coroutineDispatcher, T t2) {
|
|
Continuation<T> continuation = this.delegate;
|
|
DispatchedContinuation dispatchedContinuation = continuation instanceof DispatchedContinuation ? (DispatchedContinuation) continuation : null;
|
|
resumeImpl$default(this, t2, (dispatchedContinuation != null ? dispatchedContinuation.dispatcher : null) == coroutineDispatcher ? 4 : this.resumeMode, null, 4, null);
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.CancellableContinuation
|
|
public void resumeUndispatchedWithException(CoroutineDispatcher coroutineDispatcher, Throwable th) {
|
|
Continuation<T> continuation = this.delegate;
|
|
DispatchedContinuation dispatchedContinuation = continuation instanceof DispatchedContinuation ? (DispatchedContinuation) continuation : null;
|
|
resumeImpl$default(this, new CompletedExceptionally(th, false, 2, null), (dispatchedContinuation != null ? dispatchedContinuation.dispatcher : null) == coroutineDispatcher ? 4 : this.resumeMode, null, 4, null);
|
|
}
|
|
|
|
@Override // kotlin.coroutines.Continuation
|
|
public void resumeWith(Object result) {
|
|
resumeImpl$default(this, CompletionStateKt.toState(result, this), this.resumeMode, null, 4, null);
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.DispatchedTask
|
|
public Object takeState$kotlinx_coroutines_core() {
|
|
return getState$kotlinx_coroutines_core();
|
|
}
|
|
|
|
public String toString() {
|
|
return nameString() + '(' + DebugStringsKt.toDebugString(this.delegate) + "){" + getStateDebugRepresentation() + "}@" + DebugStringsKt.getHexAddress(this);
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.CancellableContinuation
|
|
public Object tryResumeWithException(Throwable exception) {
|
|
return tryResumeImpl(new CompletedExceptionally(exception, false, 2, null), null, null);
|
|
}
|
|
|
|
private final /* synthetic */ void loop$atomicfu(Object obj, AtomicReferenceFieldUpdater atomicReferenceFieldUpdater, Function1<Object, Unit> function1) {
|
|
while (true) {
|
|
function1.invoke(atomicReferenceFieldUpdater.get(obj));
|
|
}
|
|
}
|
|
|
|
private final void callCancelHandler(Function1<? super Throwable, Unit> handler, Throwable cause) {
|
|
try {
|
|
handler.invoke(cause);
|
|
} catch (Throwable th) {
|
|
CoroutineExceptionHandlerKt.handleCoroutineException(get$context(), new CompletionHandlerException("Exception in invokeOnCancellation handler for " + this, th));
|
|
}
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.CancellableContinuation
|
|
public void invokeOnCancellation(Function1<? super Throwable, Unit> handler) {
|
|
invokeOnCancellationImpl(makeCancelHandler(handler));
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.CancellableContinuation
|
|
public Object tryResume(T value, Object idempotent) {
|
|
return tryResumeImpl(value, idempotent, null);
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.CancellableContinuation
|
|
public Object tryResume(T value, Object idempotent, Function1<? super Throwable, Unit> onCancellation) {
|
|
return tryResumeImpl(value, idempotent, onCancellation);
|
|
}
|
|
}
|