- 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
102 lines
3.1 KiB
Java
102 lines
3.1 KiB
Java
package kotlinx.coroutines;
|
|
|
|
import kotlin.collections.ArrayDeque;
|
|
import kotlinx.coroutines.internal.LimitedDispatcherKt;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public abstract class EventLoop extends CoroutineDispatcher {
|
|
public boolean shared;
|
|
public ArrayDeque unconfinedQueue;
|
|
public long useCount;
|
|
|
|
public final long delta(boolean z) {
|
|
return z ? 4294967296L : 1L;
|
|
}
|
|
|
|
public abstract long processNextEvent();
|
|
|
|
public boolean shouldBeProcessedFromContext() {
|
|
return false;
|
|
}
|
|
|
|
public abstract void shutdown();
|
|
|
|
public long getNextTime() {
|
|
ArrayDeque arrayDeque = this.unconfinedQueue;
|
|
return (arrayDeque == null || arrayDeque.isEmpty()) ? Long.MAX_VALUE : 0L;
|
|
}
|
|
|
|
public final boolean processUnconfinedEvent() {
|
|
DispatchedTask dispatchedTask;
|
|
ArrayDeque arrayDeque = this.unconfinedQueue;
|
|
if (arrayDeque == null || (dispatchedTask = (DispatchedTask) arrayDeque.removeFirstOrNull()) == null) {
|
|
return false;
|
|
}
|
|
dispatchedTask.run();
|
|
return true;
|
|
}
|
|
|
|
public final void dispatchUnconfined(DispatchedTask dispatchedTask) {
|
|
ArrayDeque arrayDeque = this.unconfinedQueue;
|
|
if (arrayDeque == null) {
|
|
arrayDeque = new ArrayDeque();
|
|
this.unconfinedQueue = arrayDeque;
|
|
}
|
|
arrayDeque.addLast(dispatchedTask);
|
|
}
|
|
|
|
public final boolean isUnconfinedLoopActive() {
|
|
return this.useCount >= delta(true);
|
|
}
|
|
|
|
public final boolean isUnconfinedQueueEmpty() {
|
|
ArrayDeque arrayDeque = this.unconfinedQueue;
|
|
if (arrayDeque != null) {
|
|
return arrayDeque.isEmpty();
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public static /* synthetic */ void incrementUseCount$default(EventLoop eventLoop, boolean z, int i, Object obj) {
|
|
if (obj != null) {
|
|
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: incrementUseCount");
|
|
}
|
|
if ((i & 1) != 0) {
|
|
z = false;
|
|
}
|
|
eventLoop.incrementUseCount(z);
|
|
}
|
|
|
|
public final void incrementUseCount(boolean z) {
|
|
this.useCount += delta(z);
|
|
if (z) {
|
|
return;
|
|
}
|
|
this.shared = true;
|
|
}
|
|
|
|
public static /* synthetic */ void decrementUseCount$default(EventLoop eventLoop, boolean z, int i, Object obj) {
|
|
if (obj != null) {
|
|
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: decrementUseCount");
|
|
}
|
|
if ((i & 1) != 0) {
|
|
z = false;
|
|
}
|
|
eventLoop.decrementUseCount(z);
|
|
}
|
|
|
|
public final void decrementUseCount(boolean z) {
|
|
long delta = this.useCount - delta(z);
|
|
this.useCount = delta;
|
|
if (delta <= 0 && this.shared) {
|
|
shutdown();
|
|
}
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.CoroutineDispatcher
|
|
public final CoroutineDispatcher limitedParallelism(int i) {
|
|
LimitedDispatcherKt.checkParallelism(i);
|
|
return this;
|
|
}
|
|
}
|