- 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
151 lines
6.0 KiB
Java
151 lines
6.0 KiB
Java
package kotlinx.coroutines;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
|
|
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
|
|
import kotlin.Result;
|
|
import kotlin.Unit;
|
|
import kotlin.coroutines.Continuation;
|
|
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt;
|
|
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt;
|
|
import kotlin.coroutines.jvm.internal.DebugProbesKt;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public final class AwaitAll {
|
|
public static final AtomicIntegerFieldUpdater notCompletedCount$FU = AtomicIntegerFieldUpdater.newUpdater(AwaitAll.class, "notCompletedCount");
|
|
public final Deferred[] deferreds;
|
|
private volatile int notCompletedCount;
|
|
|
|
public AwaitAll(Deferred[] deferredArr) {
|
|
this.deferreds = deferredArr;
|
|
this.notCompletedCount = deferredArr.length;
|
|
}
|
|
|
|
public final class DisposeHandlersOnCancel extends CancelHandler {
|
|
public final AwaitAllNode[] nodes;
|
|
|
|
public DisposeHandlersOnCancel(AwaitAllNode[] awaitAllNodeArr) {
|
|
this.nodes = awaitAllNodeArr;
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public /* bridge */ /* synthetic */ Object invoke(Object obj) {
|
|
invoke((Throwable) obj);
|
|
return Unit.INSTANCE;
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.CancelHandlerBase
|
|
public void invoke(Throwable th) {
|
|
disposeAll();
|
|
}
|
|
|
|
public String toString() {
|
|
return "DisposeHandlersOnCancel[" + this.nodes + ']';
|
|
}
|
|
|
|
public final void disposeAll() {
|
|
for (AwaitAllNode awaitAllNode : this.nodes) {
|
|
awaitAllNode.getHandle().dispose();
|
|
}
|
|
}
|
|
}
|
|
|
|
public final class AwaitAllNode extends JobNode {
|
|
public static final AtomicReferenceFieldUpdater _disposer$FU = AtomicReferenceFieldUpdater.newUpdater(AwaitAllNode.class, Object.class, "_disposer");
|
|
private volatile Object _disposer;
|
|
public final CancellableContinuation continuation;
|
|
public DisposableHandle handle;
|
|
|
|
public final void setHandle(DisposableHandle disposableHandle) {
|
|
this.handle = disposableHandle;
|
|
}
|
|
|
|
public AwaitAllNode(CancellableContinuation cancellableContinuation) {
|
|
this.continuation = cancellableContinuation;
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public /* bridge */ /* synthetic */ Object invoke(Object obj) {
|
|
invoke((Throwable) obj);
|
|
return Unit.INSTANCE;
|
|
}
|
|
|
|
public final DisposableHandle getHandle() {
|
|
DisposableHandle disposableHandle = this.handle;
|
|
if (disposableHandle != null) {
|
|
return disposableHandle;
|
|
}
|
|
Intrinsics.throwUninitializedPropertyAccessException("handle");
|
|
return null;
|
|
}
|
|
|
|
public final DisposeHandlersOnCancel getDisposer() {
|
|
return (DisposeHandlersOnCancel) _disposer$FU.get(this);
|
|
}
|
|
|
|
public final void setDisposer(DisposeHandlersOnCancel disposeHandlersOnCancel) {
|
|
_disposer$FU.set(this, disposeHandlersOnCancel);
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.CompletionHandlerBase
|
|
public void invoke(Throwable th) {
|
|
if (th != null) {
|
|
Object tryResumeWithException = this.continuation.tryResumeWithException(th);
|
|
if (tryResumeWithException != null) {
|
|
this.continuation.completeResume(tryResumeWithException);
|
|
DisposeHandlersOnCancel disposer = getDisposer();
|
|
if (disposer != null) {
|
|
disposer.disposeAll();
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
if (AwaitAll.notCompletedCount$FU.decrementAndGet(AwaitAll.this) == 0) {
|
|
CancellableContinuation cancellableContinuation = this.continuation;
|
|
Deferred[] deferredArr = AwaitAll.this.deferreds;
|
|
ArrayList arrayList = new ArrayList(deferredArr.length);
|
|
for (Deferred deferred : deferredArr) {
|
|
arrayList.add(deferred.getCompleted());
|
|
}
|
|
cancellableContinuation.resumeWith(Result.m4060constructorimpl(arrayList));
|
|
}
|
|
}
|
|
}
|
|
|
|
public final Object await(Continuation continuation) {
|
|
Continuation intercepted;
|
|
Object coroutine_suspended;
|
|
intercepted = IntrinsicsKt__IntrinsicsJvmKt.intercepted(continuation);
|
|
CancellableContinuationImpl cancellableContinuationImpl = new CancellableContinuationImpl(intercepted, 1);
|
|
cancellableContinuationImpl.initCancellability();
|
|
int length = this.deferreds.length;
|
|
AwaitAllNode[] awaitAllNodeArr = new AwaitAllNode[length];
|
|
for (int i = 0; i < length; i++) {
|
|
Deferred deferred = this.deferreds[i];
|
|
deferred.start();
|
|
AwaitAllNode awaitAllNode = new AwaitAllNode(cancellableContinuationImpl);
|
|
awaitAllNode.setHandle(deferred.invokeOnCompletion(awaitAllNode));
|
|
Unit unit = Unit.INSTANCE;
|
|
awaitAllNodeArr[i] = awaitAllNode;
|
|
}
|
|
DisposeHandlersOnCancel disposeHandlersOnCancel = new DisposeHandlersOnCancel(awaitAllNodeArr);
|
|
for (int i2 = 0; i2 < length; i2++) {
|
|
awaitAllNodeArr[i2].setDisposer(disposeHandlersOnCancel);
|
|
}
|
|
if (cancellableContinuationImpl.isCompleted()) {
|
|
disposeHandlersOnCancel.disposeAll();
|
|
} else {
|
|
cancellableContinuationImpl.invokeOnCancellation(disposeHandlersOnCancel);
|
|
}
|
|
Object result = cancellableContinuationImpl.getResult();
|
|
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
|
|
if (result == coroutine_suspended) {
|
|
DebugProbesKt.probeCoroutineSuspended(continuation);
|
|
}
|
|
return result;
|
|
}
|
|
}
|