- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
108 lines
5.3 KiB
Java
108 lines
5.3 KiB
Java
package kotlinx.coroutines.internal;
|
|
|
|
import java.util.concurrent.CancellationException;
|
|
import kotlin.Result;
|
|
import kotlin.ResultKt;
|
|
import kotlin.Unit;
|
|
import kotlin.coroutines.Continuation;
|
|
import kotlin.coroutines.CoroutineContext;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlinx.coroutines.CompletionStateKt;
|
|
import kotlinx.coroutines.CoroutineContextKt;
|
|
import kotlinx.coroutines.EventLoop;
|
|
import kotlinx.coroutines.Job;
|
|
import kotlinx.coroutines.ThreadLocalEventLoop;
|
|
import kotlinx.coroutines.UndispatchedCoroutine;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public abstract class DispatchedContinuationKt {
|
|
public static final Symbol UNDEFINED = new Symbol("UNDEFINED");
|
|
public static final Symbol REUSABLE_CLAIMED = new Symbol("REUSABLE_CLAIMED");
|
|
|
|
public static /* synthetic */ void resumeCancellableWith$default(Continuation continuation, Object obj, Function1 function1, int i, Object obj2) {
|
|
if ((i & 2) != 0) {
|
|
function1 = null;
|
|
}
|
|
resumeCancellableWith(continuation, obj, function1);
|
|
}
|
|
|
|
public static final void resumeCancellableWith(Continuation continuation, Object obj, Function1 function1) {
|
|
if (continuation instanceof DispatchedContinuation) {
|
|
DispatchedContinuation dispatchedContinuation = (DispatchedContinuation) continuation;
|
|
Object state = CompletionStateKt.toState(obj, function1);
|
|
if (dispatchedContinuation.dispatcher.isDispatchNeeded(dispatchedContinuation.getContext())) {
|
|
dispatchedContinuation._state = state;
|
|
dispatchedContinuation.resumeMode = 1;
|
|
dispatchedContinuation.dispatcher.mo4148dispatch(dispatchedContinuation.getContext(), dispatchedContinuation);
|
|
return;
|
|
}
|
|
EventLoop eventLoop$kotlinx_coroutines_core = ThreadLocalEventLoop.INSTANCE.getEventLoop$kotlinx_coroutines_core();
|
|
if (!eventLoop$kotlinx_coroutines_core.isUnconfinedLoopActive()) {
|
|
eventLoop$kotlinx_coroutines_core.incrementUseCount(true);
|
|
try {
|
|
Job job = (Job) dispatchedContinuation.getContext().get(Job.Key);
|
|
if (job != null && !job.isActive()) {
|
|
CancellationException cancellationException = job.getCancellationException();
|
|
dispatchedContinuation.cancelCompletedResult$kotlinx_coroutines_core(state, cancellationException);
|
|
Result.Companion companion = Result.Companion;
|
|
dispatchedContinuation.resumeWith(Result.m4060constructorimpl(ResultKt.createFailure(cancellationException)));
|
|
} else {
|
|
Continuation continuation2 = dispatchedContinuation.continuation;
|
|
Object obj2 = dispatchedContinuation.countOrElement;
|
|
CoroutineContext context = continuation2.getContext();
|
|
Object updateThreadContext = ThreadContextKt.updateThreadContext(context, obj2);
|
|
UndispatchedCoroutine updateUndispatchedCompletion = updateThreadContext != ThreadContextKt.NO_THREAD_ELEMENTS ? CoroutineContextKt.updateUndispatchedCompletion(continuation2, context, updateThreadContext) : null;
|
|
try {
|
|
dispatchedContinuation.continuation.resumeWith(obj);
|
|
Unit unit = Unit.INSTANCE;
|
|
} finally {
|
|
if (updateUndispatchedCompletion == null || updateUndispatchedCompletion.clearThreadContext()) {
|
|
ThreadContextKt.restoreThreadContext(context, updateThreadContext);
|
|
}
|
|
}
|
|
}
|
|
while (eventLoop$kotlinx_coroutines_core.processUnconfinedEvent()) {
|
|
}
|
|
} finally {
|
|
try {
|
|
return;
|
|
} finally {
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
dispatchedContinuation._state = state;
|
|
dispatchedContinuation.resumeMode = 1;
|
|
eventLoop$kotlinx_coroutines_core.dispatchUnconfined(dispatchedContinuation);
|
|
return;
|
|
}
|
|
continuation.resumeWith(obj);
|
|
}
|
|
|
|
public static final boolean yieldUndispatched(DispatchedContinuation dispatchedContinuation) {
|
|
Unit unit = Unit.INSTANCE;
|
|
EventLoop eventLoop$kotlinx_coroutines_core = ThreadLocalEventLoop.INSTANCE.getEventLoop$kotlinx_coroutines_core();
|
|
if (eventLoop$kotlinx_coroutines_core.isUnconfinedQueueEmpty()) {
|
|
return false;
|
|
}
|
|
if (!eventLoop$kotlinx_coroutines_core.isUnconfinedLoopActive()) {
|
|
eventLoop$kotlinx_coroutines_core.incrementUseCount(true);
|
|
try {
|
|
dispatchedContinuation.run();
|
|
do {
|
|
} while (eventLoop$kotlinx_coroutines_core.processUnconfinedEvent());
|
|
} finally {
|
|
try {
|
|
return false;
|
|
} finally {
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
dispatchedContinuation._state = unit;
|
|
dispatchedContinuation.resumeMode = 1;
|
|
eventLoop$kotlinx_coroutines_core.dispatchUnconfined(dispatchedContinuation);
|
|
return true;
|
|
}
|
|
}
|