Primer paso de la investigacion. Se aportan el .apk, las carpetas con el apk extraido y el apk descompilado. El archivo API_DOCUMENTATION.md es un archivo donde se anotaran los descubrimientos del funcionamiento de la API, y los .py son scripts para probar la funcionalidad de la API con los métodos que vayamos encontrando. Finalmente, los archivos .js son scripts de Frida para extraer informacion de la APP durante la ejecucion.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,19 @@
|
||||
package kotlinx.coroutines.scheduling;
|
||||
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.JvmName;
|
||||
import kotlinx.coroutines.scheduling.CoroutineScheduler;
|
||||
|
||||
@Metadata(d1 = {"\u0000\u0010\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u001a\u0010\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003H\u0001\u001a\u0010\u0010\u0004\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003H\u0001¨\u0006\u0005"}, d2 = {"isSchedulerWorker", "", "thread", "Ljava/lang/Thread;", "mayNotBlock", "kotlinx-coroutines-core"}, k = 2, mv = {1, 9, 0}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
public final class CoroutineSchedulerKt {
|
||||
@JvmName(name = "isSchedulerWorker")
|
||||
public static final boolean isSchedulerWorker(Thread thread) {
|
||||
return thread instanceof CoroutineScheduler.Worker;
|
||||
}
|
||||
|
||||
@JvmName(name = "mayNotBlock")
|
||||
public static final boolean mayNotBlock(Thread thread) {
|
||||
return (thread instanceof CoroutineScheduler.Worker) && ((CoroutineScheduler.Worker) thread).state == CoroutineScheduler.WorkerState.CPU_ACQUIRED;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package kotlinx.coroutines.scheduling;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.coroutines.CoroutineContext;
|
||||
import kotlin.coroutines.EmptyCoroutineContext;
|
||||
import kotlin.ranges.RangesKt;
|
||||
import kotlinx.coroutines.CoroutineDispatcher;
|
||||
import kotlinx.coroutines.DispatchersKt;
|
||||
import kotlinx.coroutines.ExecutorCoroutineDispatcher;
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi;
|
||||
import kotlinx.coroutines.InternalCoroutinesApi;
|
||||
import kotlinx.coroutines.internal.SystemPropsKt;
|
||||
import kotlinx.coroutines.internal.SystemPropsKt__SystemProps_commonKt;
|
||||
|
||||
@Metadata(d1 = {"\u0000>\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000e\n\u0000\bÀ\u0002\u0018\u00002\u00020\u00012\u00020\u0002B\u0007\b\u0002¢\u0006\u0002\u0010\u0003J\b\u0010\t\u001a\u00020\nH\u0016J\u001c\u0010\u000b\u001a\u00020\n2\u0006\u0010\f\u001a\u00020\r2\n\u0010\u000e\u001a\u00060\u000fj\u0002`\u0010H\u0016J\u001c\u0010\u0011\u001a\u00020\n2\u0006\u0010\f\u001a\u00020\r2\n\u0010\u000e\u001a\u00060\u000fj\u0002`\u0010H\u0017J\u0010\u0010\u0012\u001a\u00020\n2\u0006\u0010\u0013\u001a\u00020\u000fH\u0016J\u0010\u0010\u0014\u001a\u00020\u00052\u0006\u0010\u0015\u001a\u00020\u0016H\u0017J\b\u0010\u0017\u001a\u00020\u0018H\u0016R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0006\u001a\u00020\u00028VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u0007\u0010\b¨\u0006\u0019"}, d2 = {"Lkotlinx/coroutines/scheduling/DefaultIoScheduler;", "Lkotlinx/coroutines/ExecutorCoroutineDispatcher;", "Ljava/util/concurrent/Executor;", "()V", "default", "Lkotlinx/coroutines/CoroutineDispatcher;", "executor", "getExecutor", "()Ljava/util/concurrent/Executor;", "close", "", "dispatch", "context", "Lkotlin/coroutines/CoroutineContext;", "block", "Ljava/lang/Runnable;", "Lkotlinx/coroutines/Runnable;", "dispatchYield", "execute", "command", "limitedParallelism", "parallelism", "", "toString", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
public final class DefaultIoScheduler extends ExecutorCoroutineDispatcher implements Executor {
|
||||
public static final DefaultIoScheduler INSTANCE = new DefaultIoScheduler();
|
||||
private static final CoroutineDispatcher default;
|
||||
|
||||
static {
|
||||
int systemProp$default;
|
||||
UnlimitedIoScheduler unlimitedIoScheduler = UnlimitedIoScheduler.INSTANCE;
|
||||
systemProp$default = SystemPropsKt__SystemProps_commonKt.systemProp$default(DispatchersKt.IO_PARALLELISM_PROPERTY_NAME, RangesKt.coerceAtLeast(64, SystemPropsKt.getAVAILABLE_PROCESSORS()), 0, 0, 12, (Object) null);
|
||||
default = unlimitedIoScheduler.limitedParallelism(systemProp$default);
|
||||
}
|
||||
|
||||
private DefaultIoScheduler() {
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.ExecutorCoroutineDispatcher, java.io.Closeable, java.lang.AutoCloseable
|
||||
public void close() {
|
||||
throw new IllegalStateException("Cannot be invoked on Dispatchers.IO");
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.CoroutineDispatcher
|
||||
/* renamed from: dispatch */
|
||||
public void mo1685dispatch(CoroutineContext context, Runnable block) {
|
||||
default.mo1685dispatch(context, block);
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.CoroutineDispatcher
|
||||
@InternalCoroutinesApi
|
||||
public void dispatchYield(CoroutineContext context, Runnable block) {
|
||||
default.dispatchYield(context, block);
|
||||
}
|
||||
|
||||
@Override // java.util.concurrent.Executor
|
||||
public void execute(Runnable command) {
|
||||
mo1685dispatch(EmptyCoroutineContext.INSTANCE, command);
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.ExecutorCoroutineDispatcher
|
||||
public Executor getExecutor() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.CoroutineDispatcher
|
||||
@ExperimentalCoroutinesApi
|
||||
public CoroutineDispatcher limitedParallelism(int parallelism) {
|
||||
return UnlimitedIoScheduler.INSTANCE.limitedParallelism(parallelism);
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.CoroutineDispatcher
|
||||
public String toString() {
|
||||
return "Dispatchers.IO";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package kotlinx.coroutines.scheduling;
|
||||
|
||||
import kotlin.Metadata;
|
||||
import kotlinx.coroutines.CoroutineDispatcher;
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi;
|
||||
import kotlinx.coroutines.internal.LimitedDispatcherKt;
|
||||
|
||||
@Metadata(d1 = {"\u0000&\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0000\bÀ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\b\u0010\u0003\u001a\u00020\u0004H\u0016J\u0010\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\bH\u0017J\r\u0010\t\u001a\u00020\u0004H\u0000¢\u0006\u0002\b\nJ\b\u0010\u000b\u001a\u00020\fH\u0016¨\u0006\r"}, d2 = {"Lkotlinx/coroutines/scheduling/DefaultScheduler;", "Lkotlinx/coroutines/scheduling/SchedulerCoroutineDispatcher;", "()V", "close", "", "limitedParallelism", "Lkotlinx/coroutines/CoroutineDispatcher;", "parallelism", "", "shutdown", "shutdown$kotlinx_coroutines_core", "toString", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
public final class DefaultScheduler extends SchedulerCoroutineDispatcher {
|
||||
public static final DefaultScheduler INSTANCE = new DefaultScheduler();
|
||||
|
||||
private DefaultScheduler() {
|
||||
super(TasksKt.CORE_POOL_SIZE, TasksKt.MAX_POOL_SIZE, TasksKt.IDLE_WORKER_KEEP_ALIVE_NS, TasksKt.DEFAULT_SCHEDULER_NAME);
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.scheduling.SchedulerCoroutineDispatcher, kotlinx.coroutines.ExecutorCoroutineDispatcher, java.io.Closeable, java.lang.AutoCloseable
|
||||
public void close() {
|
||||
throw new UnsupportedOperationException("Dispatchers.Default cannot be closed");
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.CoroutineDispatcher
|
||||
@ExperimentalCoroutinesApi
|
||||
public CoroutineDispatcher limitedParallelism(int parallelism) {
|
||||
LimitedDispatcherKt.checkParallelism(parallelism);
|
||||
return parallelism >= TasksKt.CORE_POOL_SIZE ? this : super.limitedParallelism(parallelism);
|
||||
}
|
||||
|
||||
public final void shutdown$kotlinx_coroutines_core() {
|
||||
super.close();
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.CoroutineDispatcher
|
||||
public String toString() {
|
||||
return "Dispatchers.Default";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package kotlinx.coroutines.scheduling;
|
||||
|
||||
import com.google.android.gms.measurement.internal.a;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
import kotlin.Deprecated;
|
||||
import kotlin.DeprecationLevel;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.PublishedApi;
|
||||
import kotlin.coroutines.CoroutineContext;
|
||||
import kotlin.jvm.internal.DefaultConstructorMarker;
|
||||
import kotlin.jvm.internal.SourceDebugExtension;
|
||||
import kotlinx.coroutines.CoroutineDispatcher;
|
||||
import kotlinx.coroutines.DefaultExecutor;
|
||||
import kotlinx.coroutines.ExecutorCoroutineDispatcher;
|
||||
|
||||
@Metadata(d1 = {"\u0000^\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0005\b\u0011\u0018\u00002\u00020\u0001B%\b\u0016\u0012\b\b\u0002\u0010\u0002\u001a\u00020\u0003\u0012\b\b\u0002\u0010\u0004\u001a\u00020\u0003\u0012\b\b\u0002\u0010\u0005\u001a\u00020\u0006¢\u0006\u0002\u0010\u0007B\u001b\b\u0017\u0012\b\b\u0002\u0010\u0002\u001a\u00020\u0003\u0012\b\b\u0002\u0010\u0004\u001a\u00020\u0003¢\u0006\u0002\u0010\bB'\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0003\u0012\u0006\u0010\t\u001a\u00020\n\u0012\b\b\u0002\u0010\u0005\u001a\u00020\u0006¢\u0006\u0002\u0010\u000bJ\u0010\u0010\u0012\u001a\u00020\u00132\b\b\u0002\u0010\u0014\u001a\u00020\u0003J\b\u0010\u0015\u001a\u00020\u0016H\u0016J\b\u0010\u0017\u001a\u00020\rH\u0002J\u001c\u0010\u0018\u001a\u00020\u00162\u0006\u0010\u0019\u001a\u00020\u001a2\n\u0010\u001b\u001a\u00060\u001cj\u0002`\u001dH\u0016J)\u0010\u001e\u001a\u00020\u00162\n\u0010\u001b\u001a\u00060\u001cj\u0002`\u001d2\u0006\u0010\u0019\u001a\u00020\u001f2\u0006\u0010 \u001a\u00020!H\u0000¢\u0006\u0002\b\"J\u001c\u0010#\u001a\u00020\u00162\u0006\u0010\u0019\u001a\u00020\u001a2\n\u0010\u001b\u001a\u00060\u001cj\u0002`\u001dH\u0016J\u000e\u0010$\u001a\u00020\u00132\u0006\u0010\u0014\u001a\u00020\u0003J\b\u0010%\u001a\u00020\u0006H\u0016R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\rX\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\u000e\u001a\u00020\u000f8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u0010\u0010\u0011R\u000e\u0010\t\u001a\u00020\nX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0004\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006&"}, d2 = {"Lkotlinx/coroutines/scheduling/ExperimentalCoroutineDispatcher;", "Lkotlinx/coroutines/ExecutorCoroutineDispatcher;", "corePoolSize", "", "maxPoolSize", "schedulerName", "", "(IILjava/lang/String;)V", "(II)V", "idleWorkerKeepAliveNs", "", "(IIJLjava/lang/String;)V", "coroutineScheduler", "Lkotlinx/coroutines/scheduling/CoroutineScheduler;", "executor", "Ljava/util/concurrent/Executor;", "getExecutor", "()Ljava/util/concurrent/Executor;", "blocking", "Lkotlinx/coroutines/CoroutineDispatcher;", "parallelism", "close", "", "createScheduler", "dispatch", "context", "Lkotlin/coroutines/CoroutineContext;", "block", "Ljava/lang/Runnable;", "Lkotlinx/coroutines/Runnable;", "dispatchWithContext", "Lkotlinx/coroutines/scheduling/TaskContext;", "tailDispatch", "", "dispatchWithContext$kotlinx_coroutines_core", "dispatchYield", "limited", "toString", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
||||
@PublishedApi
|
||||
@SourceDebugExtension({"SMAP\nDeprecated.kt\nKotlin\n*S Kotlin\n*F\n+ 1 Deprecated.kt\nkotlinx/coroutines/scheduling/ExperimentalCoroutineDispatcher\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,213:1\n1#2:214\n*E\n"})
|
||||
/* loaded from: classes3.dex */
|
||||
public class ExperimentalCoroutineDispatcher extends ExecutorCoroutineDispatcher {
|
||||
private final int corePoolSize;
|
||||
private CoroutineScheduler coroutineScheduler;
|
||||
private final long idleWorkerKeepAliveNs;
|
||||
private final int maxPoolSize;
|
||||
private final String schedulerName;
|
||||
|
||||
public /* synthetic */ ExperimentalCoroutineDispatcher(int i, int i4, long j4, String str, int i5, DefaultConstructorMarker defaultConstructorMarker) {
|
||||
this(i, i4, j4, (i5 & 8) != 0 ? "CoroutineScheduler" : str);
|
||||
}
|
||||
|
||||
public static /* synthetic */ CoroutineDispatcher blocking$default(ExperimentalCoroutineDispatcher experimentalCoroutineDispatcher, int i, int i4, Object obj) {
|
||||
if (obj != null) {
|
||||
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: blocking");
|
||||
}
|
||||
if ((i4 & 1) != 0) {
|
||||
i = 16;
|
||||
}
|
||||
return experimentalCoroutineDispatcher.blocking(i);
|
||||
}
|
||||
|
||||
private final CoroutineScheduler createScheduler() {
|
||||
return new CoroutineScheduler(this.corePoolSize, this.maxPoolSize, this.idleWorkerKeepAliveNs, this.schedulerName);
|
||||
}
|
||||
|
||||
public final CoroutineDispatcher blocking(int parallelism) {
|
||||
if (parallelism > 0) {
|
||||
return new LimitingDispatcher(this, parallelism, null, 1);
|
||||
}
|
||||
throw new IllegalArgumentException(a.l(parallelism, "Expected positive parallelism level, but have ").toString());
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.ExecutorCoroutineDispatcher, java.io.Closeable, java.lang.AutoCloseable
|
||||
public void close() {
|
||||
this.coroutineScheduler.close();
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.CoroutineDispatcher
|
||||
/* renamed from: dispatch */
|
||||
public void mo1685dispatch(CoroutineContext context, Runnable block) {
|
||||
Runnable runnable;
|
||||
try {
|
||||
runnable = block;
|
||||
try {
|
||||
CoroutineScheduler.dispatch$default(this.coroutineScheduler, runnable, null, false, 6, null);
|
||||
} catch (RejectedExecutionException unused) {
|
||||
DefaultExecutor.INSTANCE.mo1685dispatch(context, runnable);
|
||||
}
|
||||
} catch (RejectedExecutionException unused2) {
|
||||
runnable = block;
|
||||
}
|
||||
}
|
||||
|
||||
public final void dispatchWithContext$kotlinx_coroutines_core(Runnable block, TaskContext context, boolean tailDispatch) {
|
||||
try {
|
||||
this.coroutineScheduler.dispatch(block, context, tailDispatch);
|
||||
} catch (RejectedExecutionException unused) {
|
||||
DefaultExecutor.INSTANCE.enqueue(this.coroutineScheduler.createTask(block, context));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.CoroutineDispatcher
|
||||
public void dispatchYield(CoroutineContext context, Runnable block) {
|
||||
Runnable runnable;
|
||||
try {
|
||||
runnable = block;
|
||||
try {
|
||||
CoroutineScheduler.dispatch$default(this.coroutineScheduler, runnable, null, true, 2, null);
|
||||
} catch (RejectedExecutionException unused) {
|
||||
DefaultExecutor.INSTANCE.dispatchYield(context, runnable);
|
||||
}
|
||||
} catch (RejectedExecutionException unused2) {
|
||||
runnable = block;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.ExecutorCoroutineDispatcher
|
||||
public Executor getExecutor() {
|
||||
return this.coroutineScheduler;
|
||||
}
|
||||
|
||||
public final CoroutineDispatcher limited(int parallelism) {
|
||||
if (parallelism <= 0) {
|
||||
throw new IllegalArgumentException(a.l(parallelism, "Expected positive parallelism level, but have ").toString());
|
||||
}
|
||||
if (parallelism <= this.corePoolSize) {
|
||||
return new LimitingDispatcher(this, parallelism, null, 0);
|
||||
}
|
||||
throw new IllegalArgumentException(("Expected parallelism level lesser than core pool size (" + this.corePoolSize + "), but have " + parallelism).toString());
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.CoroutineDispatcher
|
||||
public String toString() {
|
||||
return super.toString() + "[scheduler = " + this.coroutineScheduler + ']';
|
||||
}
|
||||
|
||||
public ExperimentalCoroutineDispatcher(int i, int i4, long j4, String str) {
|
||||
this.corePoolSize = i;
|
||||
this.maxPoolSize = i4;
|
||||
this.idleWorkerKeepAliveNs = j4;
|
||||
this.schedulerName = str;
|
||||
this.coroutineScheduler = createScheduler();
|
||||
}
|
||||
|
||||
public /* synthetic */ ExperimentalCoroutineDispatcher(int i, int i4, String str, int i5, DefaultConstructorMarker defaultConstructorMarker) {
|
||||
this((i5 & 1) != 0 ? TasksKt.CORE_POOL_SIZE : i, (i5 & 2) != 0 ? TasksKt.MAX_POOL_SIZE : i4, (i5 & 4) != 0 ? TasksKt.DEFAULT_SCHEDULER_NAME : str);
|
||||
}
|
||||
|
||||
public ExperimentalCoroutineDispatcher(int i, int i4, String str) {
|
||||
this(i, i4, TasksKt.IDLE_WORKER_KEEP_ALIVE_NS, str);
|
||||
}
|
||||
|
||||
public /* synthetic */ ExperimentalCoroutineDispatcher(int i, int i4, int i5, DefaultConstructorMarker defaultConstructorMarker) {
|
||||
this((i5 & 1) != 0 ? TasksKt.CORE_POOL_SIZE : i, (i5 & 2) != 0 ? TasksKt.MAX_POOL_SIZE : i4);
|
||||
}
|
||||
|
||||
@Deprecated(level = DeprecationLevel.HIDDEN, message = "Binary compatibility for Ktor 1.0-beta")
|
||||
public /* synthetic */ ExperimentalCoroutineDispatcher(int i, int i4) {
|
||||
this(i, i4, TasksKt.IDLE_WORKER_KEEP_ALIVE_NS, null, 8, null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package kotlinx.coroutines.scheduling;
|
||||
|
||||
import kotlin.Metadata;
|
||||
import kotlinx.coroutines.internal.LockFreeTaskQueue;
|
||||
|
||||
@Metadata(d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0000\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0003¨\u0006\u0004"}, d2 = {"Lkotlinx/coroutines/scheduling/GlobalQueue;", "Lkotlinx/coroutines/internal/LockFreeTaskQueue;", "Lkotlinx/coroutines/scheduling/Task;", "()V", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
public final class GlobalQueue extends LockFreeTaskQueue<Task> {
|
||||
public GlobalQueue() {
|
||||
super(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package kotlinx.coroutines.scheduling;
|
||||
|
||||
import com.google.android.gms.measurement.api.AppMeasurementSdk;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.coroutines.CoroutineContext;
|
||||
import kotlinx.coroutines.ExecutorCoroutineDispatcher;
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
@Metadata(d1 = {"\u0000T\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\u0000\n\u0002\u0010\u000e\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0005\b\u0002\u0018\u00002\u00020\u00012\u00020\u00022\u00020\u0003B'\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007\u0012\b\u0010\b\u001a\u0004\u0018\u00010\t\u0012\u0006\u0010\n\u001a\u00020\u0007¢\u0006\u0002\u0010\u000bJ\b\u0010\u0017\u001a\u00020\u0018H\u0016J\b\u0010\u0019\u001a\u00020\u0018H\u0016J\u001c\u0010\u001a\u001a\u00020\u00182\u0006\u0010\u001b\u001a\u00020\u001c2\n\u0010\u001d\u001a\u00060\u0013j\u0002`\u0014H\u0016J\u001c\u0010\u001a\u001a\u00020\u00182\n\u0010\u001d\u001a\u00060\u0013j\u0002`\u00142\u0006\u0010\u001e\u001a\u00020\u001fH\u0002J\u001c\u0010 \u001a\u00020\u00182\u0006\u0010\u001b\u001a\u00020\u001c2\n\u0010\u001d\u001a\u00060\u0013j\u0002`\u0014H\u0016J\u0014\u0010!\u001a\u00020\u00182\n\u0010\"\u001a\u00060\u0013j\u0002`\u0014H\u0016J\b\u0010#\u001a\u00020\tH\u0016R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\f\u001a\u00020\u00038VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\r\u0010\u000eR\t\u0010\u000f\u001a\u00020\u0010X\u0082\u0004R\u0010\u0010\b\u001a\u0004\u0018\u00010\tX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u0018\u0010\u0011\u001a\f\u0012\b\u0012\u00060\u0013j\u0002`\u00140\u0012X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\n\u001a\u00020\u0007X\u0096\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0015\u0010\u0016¨\u0006$"}, d2 = {"Lkotlinx/coroutines/scheduling/LimitingDispatcher;", "Lkotlinx/coroutines/ExecutorCoroutineDispatcher;", "Lkotlinx/coroutines/scheduling/TaskContext;", "Ljava/util/concurrent/Executor;", "dispatcher", "Lkotlinx/coroutines/scheduling/ExperimentalCoroutineDispatcher;", "parallelism", "", AppMeasurementSdk.ConditionalUserProperty.NAME, "", "taskMode", "(Lkotlinx/coroutines/scheduling/ExperimentalCoroutineDispatcher;ILjava/lang/String;I)V", "executor", "getExecutor", "()Ljava/util/concurrent/Executor;", "inFlightTasks", "Lkotlinx/atomicfu/AtomicInt;", "queue", "Ljava/util/concurrent/ConcurrentLinkedQueue;", "Ljava/lang/Runnable;", "Lkotlinx/coroutines/Runnable;", "getTaskMode", "()I", "afterTask", "", "close", "dispatch", "context", "Lkotlin/coroutines/CoroutineContext;", "block", "tailDispatch", "", "dispatchYield", "execute", "command", "toString", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
public final class LimitingDispatcher extends ExecutorCoroutineDispatcher implements TaskContext, Executor {
|
||||
private static final /* synthetic */ AtomicIntegerFieldUpdater inFlightTasks$volatile$FU = AtomicIntegerFieldUpdater.newUpdater(LimitingDispatcher.class, "inFlightTasks$volatile");
|
||||
private final ExperimentalCoroutineDispatcher dispatcher;
|
||||
private volatile /* synthetic */ int inFlightTasks$volatile;
|
||||
private final String name;
|
||||
private final int parallelism;
|
||||
private final ConcurrentLinkedQueue<Runnable> queue = new ConcurrentLinkedQueue<>();
|
||||
private final int taskMode;
|
||||
|
||||
public LimitingDispatcher(ExperimentalCoroutineDispatcher experimentalCoroutineDispatcher, int i, String str, int i4) {
|
||||
this.dispatcher = experimentalCoroutineDispatcher;
|
||||
this.parallelism = i;
|
||||
this.name = str;
|
||||
this.taskMode = i4;
|
||||
}
|
||||
|
||||
private final /* synthetic */ int getInFlightTasks$volatile() {
|
||||
return this.inFlightTasks$volatile;
|
||||
}
|
||||
|
||||
private final /* synthetic */ void setInFlightTasks$volatile(int i) {
|
||||
this.inFlightTasks$volatile = i;
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.scheduling.TaskContext
|
||||
public void afterTask() {
|
||||
Runnable poll = this.queue.poll();
|
||||
if (poll != null) {
|
||||
this.dispatcher.dispatchWithContext$kotlinx_coroutines_core(poll, this, true);
|
||||
return;
|
||||
}
|
||||
inFlightTasks$volatile$FU.decrementAndGet(this);
|
||||
Runnable poll2 = this.queue.poll();
|
||||
if (poll2 == null) {
|
||||
return;
|
||||
}
|
||||
dispatch(poll2, true);
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.ExecutorCoroutineDispatcher, java.io.Closeable, java.lang.AutoCloseable
|
||||
public void close() {
|
||||
throw new IllegalStateException("Close cannot be invoked on LimitingBlockingDispatcher");
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.CoroutineDispatcher
|
||||
/* renamed from: dispatch */
|
||||
public void mo1685dispatch(CoroutineContext context, Runnable block) {
|
||||
dispatch(block, false);
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.CoroutineDispatcher
|
||||
public void dispatchYield(CoroutineContext context, Runnable block) {
|
||||
dispatch(block, true);
|
||||
}
|
||||
|
||||
@Override // java.util.concurrent.Executor
|
||||
public void execute(Runnable command) {
|
||||
dispatch(command, false);
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.ExecutorCoroutineDispatcher
|
||||
public Executor getExecutor() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.scheduling.TaskContext
|
||||
public int getTaskMode() {
|
||||
return this.taskMode;
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.CoroutineDispatcher
|
||||
public String toString() {
|
||||
String str = this.name;
|
||||
if (str != null) {
|
||||
return str;
|
||||
}
|
||||
return super.toString() + "[dispatcher = " + this.dispatcher + ']';
|
||||
}
|
||||
|
||||
private final void dispatch(Runnable block, boolean tailDispatch) {
|
||||
while (inFlightTasks$volatile$FU.incrementAndGet(this) > this.parallelism) {
|
||||
this.queue.add(block);
|
||||
if (inFlightTasks$volatile$FU.decrementAndGet(this) >= this.parallelism || (block = this.queue.poll()) == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.dispatcher.dispatchWithContext$kotlinx_coroutines_core(block, this, tailDispatch);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package kotlinx.coroutines.scheduling;
|
||||
|
||||
import kotlin.Metadata;
|
||||
|
||||
@Metadata(d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\bÀ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\b\u0010\u0003\u001a\u00020\u0004H\u0016¨\u0006\u0005"}, d2 = {"Lkotlinx/coroutines/scheduling/NanoTimeSource;", "Lkotlinx/coroutines/scheduling/SchedulerTimeSource;", "()V", "nanoTime", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
public final class NanoTimeSource extends SchedulerTimeSource {
|
||||
public static final NanoTimeSource INSTANCE = new NanoTimeSource();
|
||||
|
||||
private NanoTimeSource() {
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.scheduling.SchedulerTimeSource
|
||||
public long nanoTime() {
|
||||
return System.nanoTime();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package kotlinx.coroutines.scheduling;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.coroutines.CoroutineContext;
|
||||
import kotlin.jvm.internal.DefaultConstructorMarker;
|
||||
import kotlinx.coroutines.ExecutorCoroutineDispatcher;
|
||||
|
||||
@Metadata(d1 = {"\u0000T\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\n\b\u0010\u0018\u00002\u00020\u0001B-\u0012\b\b\u0002\u0010\u0002\u001a\u00020\u0003\u0012\b\b\u0002\u0010\u0004\u001a\u00020\u0003\u0012\b\b\u0002\u0010\u0005\u001a\u00020\u0006\u0012\b\b\u0002\u0010\u0007\u001a\u00020\b¢\u0006\u0002\u0010\tJ\b\u0010\u0010\u001a\u00020\u0011H\u0016J\b\u0010\u0012\u001a\u00020\u000bH\u0002J\u001c\u0010\u0013\u001a\u00020\u00112\u0006\u0010\u0014\u001a\u00020\u00152\n\u0010\u0016\u001a\u00060\u0017j\u0002`\u0018H\u0016J)\u0010\u0019\u001a\u00020\u00112\n\u0010\u0016\u001a\u00060\u0017j\u0002`\u00182\u0006\u0010\u0014\u001a\u00020\u001a2\u0006\u0010\u001b\u001a\u00020\u001cH\u0000¢\u0006\u0002\b\u001dJ\u001c\u0010\u001e\u001a\u00020\u00112\u0006\u0010\u0014\u001a\u00020\u00152\n\u0010\u0016\u001a\u00060\u0017j\u0002`\u0018H\u0016J\r\u0010\u001f\u001a\u00020\u0011H\u0000¢\u0006\u0002\b J\u0015\u0010!\u001a\u00020\u00112\u0006\u0010\"\u001a\u00020\u0006H\u0000¢\u0006\u0002\b#J\r\u0010$\u001a\u00020\u0011H\u0000¢\u0006\u0002\b%R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u000bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\f\u001a\u00020\r8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u000e\u0010\u000fR\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0004\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\bX\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006&"}, d2 = {"Lkotlinx/coroutines/scheduling/SchedulerCoroutineDispatcher;", "Lkotlinx/coroutines/ExecutorCoroutineDispatcher;", "corePoolSize", "", "maxPoolSize", "idleWorkerKeepAliveNs", "", "schedulerName", "", "(IIJLjava/lang/String;)V", "coroutineScheduler", "Lkotlinx/coroutines/scheduling/CoroutineScheduler;", "executor", "Ljava/util/concurrent/Executor;", "getExecutor", "()Ljava/util/concurrent/Executor;", "close", "", "createScheduler", "dispatch", "context", "Lkotlin/coroutines/CoroutineContext;", "block", "Ljava/lang/Runnable;", "Lkotlinx/coroutines/Runnable;", "dispatchWithContext", "Lkotlinx/coroutines/scheduling/TaskContext;", "tailDispatch", "", "dispatchWithContext$kotlinx_coroutines_core", "dispatchYield", "restore", "restore$kotlinx_coroutines_core", "shutdown", "timeout", "shutdown$kotlinx_coroutines_core", "usePrivateScheduler", "usePrivateScheduler$kotlinx_coroutines_core", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
public class SchedulerCoroutineDispatcher extends ExecutorCoroutineDispatcher {
|
||||
private final int corePoolSize;
|
||||
private CoroutineScheduler coroutineScheduler;
|
||||
private final long idleWorkerKeepAliveNs;
|
||||
private final int maxPoolSize;
|
||||
private final String schedulerName;
|
||||
|
||||
public SchedulerCoroutineDispatcher() {
|
||||
this(0, 0, 0L, null, 15, null);
|
||||
}
|
||||
|
||||
private final CoroutineScheduler createScheduler() {
|
||||
return new CoroutineScheduler(this.corePoolSize, this.maxPoolSize, this.idleWorkerKeepAliveNs, this.schedulerName);
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.ExecutorCoroutineDispatcher, java.io.Closeable, java.lang.AutoCloseable
|
||||
public void close() {
|
||||
this.coroutineScheduler.close();
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.CoroutineDispatcher
|
||||
/* renamed from: dispatch */
|
||||
public void mo1685dispatch(CoroutineContext context, Runnable block) {
|
||||
CoroutineScheduler.dispatch$default(this.coroutineScheduler, block, null, false, 6, null);
|
||||
}
|
||||
|
||||
public final void dispatchWithContext$kotlinx_coroutines_core(Runnable block, TaskContext context, boolean tailDispatch) {
|
||||
this.coroutineScheduler.dispatch(block, context, tailDispatch);
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.CoroutineDispatcher
|
||||
public void dispatchYield(CoroutineContext context, Runnable block) {
|
||||
CoroutineScheduler.dispatch$default(this.coroutineScheduler, block, null, true, 2, null);
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.ExecutorCoroutineDispatcher
|
||||
public Executor getExecutor() {
|
||||
return this.coroutineScheduler;
|
||||
}
|
||||
|
||||
public final void restore$kotlinx_coroutines_core() {
|
||||
usePrivateScheduler$kotlinx_coroutines_core();
|
||||
}
|
||||
|
||||
public final synchronized void shutdown$kotlinx_coroutines_core(long timeout) {
|
||||
this.coroutineScheduler.shutdown(timeout);
|
||||
}
|
||||
|
||||
public final synchronized void usePrivateScheduler$kotlinx_coroutines_core() {
|
||||
this.coroutineScheduler.shutdown(1000L);
|
||||
this.coroutineScheduler = createScheduler();
|
||||
}
|
||||
|
||||
public /* synthetic */ SchedulerCoroutineDispatcher(int i, int i4, long j4, String str, int i5, DefaultConstructorMarker defaultConstructorMarker) {
|
||||
this((i5 & 1) != 0 ? TasksKt.CORE_POOL_SIZE : i, (i5 & 2) != 0 ? TasksKt.MAX_POOL_SIZE : i4, (i5 & 4) != 0 ? TasksKt.IDLE_WORKER_KEEP_ALIVE_NS : j4, (i5 & 8) != 0 ? "CoroutineScheduler" : str);
|
||||
}
|
||||
|
||||
public SchedulerCoroutineDispatcher(int i, int i4, long j4, String str) {
|
||||
this.corePoolSize = i;
|
||||
this.maxPoolSize = i4;
|
||||
this.idleWorkerKeepAliveNs = j4;
|
||||
this.schedulerName = str;
|
||||
this.coroutineScheduler = createScheduler();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package kotlinx.coroutines.scheduling;
|
||||
|
||||
import kotlin.Metadata;
|
||||
|
||||
@Metadata(d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\b \u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\b\u0010\u0003\u001a\u00020\u0004H&¨\u0006\u0005"}, d2 = {"Lkotlinx/coroutines/scheduling/SchedulerTimeSource;", "", "()V", "nanoTime", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
public abstract class SchedulerTimeSource {
|
||||
public abstract long nanoTime();
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package kotlinx.coroutines.scheduling;
|
||||
|
||||
import kotlin.Metadata;
|
||||
import kotlin.PublishedApi;
|
||||
import kotlin.jvm.JvmField;
|
||||
|
||||
@Metadata(d1 = {"\u0000&\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0003\b!\u0018\u00002\u00060\u0001j\u0002`\u0002B\u0007\b\u0010¢\u0006\u0002\u0010\u0003B\u0017\b\u0000\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007¢\u0006\u0002\u0010\bR\u0015\u0010\t\u001a\u00020\n8À\u0002X\u0080\u0004¢\u0006\u0006\u001a\u0004\b\u000b\u0010\fR\u0012\u0010\u0004\u001a\u00020\u00058\u0006@\u0006X\u0087\u000e¢\u0006\u0002\n\u0000R\u0012\u0010\u0006\u001a\u00020\u00078\u0000@\u0000X\u0081\u000e¢\u0006\u0002\n\u0000¨\u0006\r"}, d2 = {"Lkotlinx/coroutines/scheduling/Task;", "Ljava/lang/Runnable;", "Lkotlinx/coroutines/Runnable;", "()V", "submissionTime", "", "taskContext", "Lkotlinx/coroutines/scheduling/TaskContext;", "(JLkotlinx/coroutines/scheduling/TaskContext;)V", "mode", "", "getMode$kotlinx_coroutines_core", "()I", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
||||
@PublishedApi
|
||||
/* loaded from: classes3.dex */
|
||||
public abstract class Task implements Runnable {
|
||||
|
||||
@JvmField
|
||||
public long submissionTime;
|
||||
|
||||
@JvmField
|
||||
public TaskContext taskContext;
|
||||
|
||||
public Task(long j4, TaskContext taskContext) {
|
||||
this.submissionTime = j4;
|
||||
this.taskContext = taskContext;
|
||||
}
|
||||
|
||||
public final int getMode$kotlinx_coroutines_core() {
|
||||
return this.taskContext.getTaskMode();
|
||||
}
|
||||
|
||||
public Task() {
|
||||
this(0L, TasksKt.NonBlockingContext);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package kotlinx.coroutines.scheduling;
|
||||
|
||||
import kotlin.Metadata;
|
||||
|
||||
@Metadata(d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\b`\u0018\u00002\u00020\u0001J\b\u0010\u0006\u001a\u00020\u0007H&R\u0012\u0010\u0002\u001a\u00020\u0003X¦\u0004¢\u0006\u0006\u001a\u0004\b\u0004\u0010\u0005¨\u0006\b"}, d2 = {"Lkotlinx/coroutines/scheduling/TaskContext;", "", "taskMode", "", "getTaskMode", "()I", "afterTask", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
public interface TaskContext {
|
||||
void afterTask();
|
||||
|
||||
int getTaskMode();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package kotlinx.coroutines.scheduling;
|
||||
|
||||
import kotlin.Metadata;
|
||||
|
||||
@Metadata(d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0000\b\u0002\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\b\u0010\u0007\u001a\u00020\bH\u0016R\u0014\u0010\u0002\u001a\u00020\u0003X\u0096\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0006¨\u0006\t"}, d2 = {"Lkotlinx/coroutines/scheduling/TaskContextImpl;", "Lkotlinx/coroutines/scheduling/TaskContext;", "taskMode", "", "(I)V", "getTaskMode", "()I", "afterTask", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
final class TaskContextImpl implements TaskContext {
|
||||
private final int taskMode;
|
||||
|
||||
public TaskContextImpl(int i) {
|
||||
this.taskMode = i;
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.scheduling.TaskContext
|
||||
public void afterTask() {
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.scheduling.TaskContext
|
||||
public int getTaskMode() {
|
||||
return this.taskMode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package kotlinx.coroutines.scheduling;
|
||||
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.JvmField;
|
||||
import kotlinx.coroutines.DebugStringsKt;
|
||||
|
||||
@Metadata(d1 = {"\u0000.\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\b\u0000\u0018\u00002\u00020\u0001B!\u0012\n\u0010\u0002\u001a\u00060\u0003j\u0002`\u0004\u0012\u0006\u0010\u0005\u001a\u00020\u0006\u0012\u0006\u0010\u0007\u001a\u00020\b¢\u0006\u0002\u0010\tJ\b\u0010\n\u001a\u00020\u000bH\u0016J\b\u0010\f\u001a\u00020\rH\u0016R\u0014\u0010\u0002\u001a\u00060\u0003j\u0002`\u00048\u0006X\u0087\u0004¢\u0006\u0002\n\u0000¨\u0006\u000e"}, d2 = {"Lkotlinx/coroutines/scheduling/TaskImpl;", "Lkotlinx/coroutines/scheduling/Task;", "block", "Ljava/lang/Runnable;", "Lkotlinx/coroutines/Runnable;", "submissionTime", "", "taskContext", "Lkotlinx/coroutines/scheduling/TaskContext;", "(Ljava/lang/Runnable;JLkotlinx/coroutines/scheduling/TaskContext;)V", "run", "", "toString", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
public final class TaskImpl extends Task {
|
||||
|
||||
@JvmField
|
||||
public final Runnable block;
|
||||
|
||||
public TaskImpl(Runnable runnable, long j4, TaskContext taskContext) {
|
||||
super(j4, taskContext);
|
||||
this.block = runnable;
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
try {
|
||||
this.block.run();
|
||||
} finally {
|
||||
this.taskContext.afterTask();
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Task[" + DebugStringsKt.getClassSimpleName(this.block) + '@' + DebugStringsKt.getHexAddress(this.block) + ", " + this.submissionTime + ", " + this.taskContext + ']';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package kotlinx.coroutines.scheduling;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.JvmField;
|
||||
import kotlin.ranges.RangesKt;
|
||||
import kotlinx.coroutines.internal.SystemPropsKt;
|
||||
import kotlinx.coroutines.internal.SystemPropsKt__SystemProps_commonKt;
|
||||
|
||||
@Metadata(d1 = {"\u0000.\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\t\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\u0018\u0002\n\u0002\b\u0002\"\u0010\u0010\u0000\u001a\u00020\u00018\u0000X\u0081\u0004¢\u0006\u0002\n\u0000\"\u0010\u0010\u0002\u001a\u00020\u00038\u0000X\u0081\u0004¢\u0006\u0002\n\u0000\"\u0010\u0010\u0004\u001a\u00020\u00058\u0000X\u0081\u0004¢\u0006\u0002\n\u0000\"\u0010\u0010\u0006\u001a\u00020\u00078\u0000X\u0081\u0004¢\u0006\u0002\n\u0000\"\u0010\u0010\b\u001a\u00020\u00038\u0000X\u0081\u0004¢\u0006\u0002\n\u0000\"\u0010\u0010\t\u001a\u00020\u00018\u0000X\u0081\u0004¢\u0006\u0002\n\u0000\"\u000e\u0010\n\u001a\u00020\u0003X\u0080T¢\u0006\u0002\n\u0000\"\u000e\u0010\u000b\u001a\u00020\u0003X\u0080T¢\u0006\u0002\n\u0000\"\u0010\u0010\f\u001a\u00020\u00078\u0000X\u0081\u0004¢\u0006\u0002\n\u0000\"\u0012\u0010\r\u001a\u00020\u000e8\u0000@\u0000X\u0081\u000e¢\u0006\u0002\n\u0000\"\u0019\u0010\u000f\u001a\u00020\u0010*\u00020\u00118À\u0002X\u0080\u0004¢\u0006\u0006\u001a\u0004\b\u000f\u0010\u0012¨\u0006\u0013"}, d2 = {"BlockingContext", "Lkotlinx/coroutines/scheduling/TaskContext;", "CORE_POOL_SIZE", "", "DEFAULT_SCHEDULER_NAME", "", "IDLE_WORKER_KEEP_ALIVE_NS", "", "MAX_POOL_SIZE", "NonBlockingContext", "TASK_NON_BLOCKING", "TASK_PROBABLY_BLOCKING", "WORK_STEALING_TIME_RESOLUTION_NS", "schedulerTimeSource", "Lkotlinx/coroutines/scheduling/SchedulerTimeSource;", "isBlocking", "", "Lkotlinx/coroutines/scheduling/Task;", "(Lkotlinx/coroutines/scheduling/Task;)Z", "kotlinx-coroutines-core"}, k = 2, mv = {1, 9, 0}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
public final class TasksKt {
|
||||
|
||||
@JvmField
|
||||
public static final TaskContext BlockingContext;
|
||||
|
||||
@JvmField
|
||||
public static final int CORE_POOL_SIZE;
|
||||
|
||||
@JvmField
|
||||
public static final String DEFAULT_SCHEDULER_NAME = SystemPropsKt.systemProp("kotlinx.coroutines.scheduler.default.name", "DefaultDispatcher");
|
||||
|
||||
@JvmField
|
||||
public static final long IDLE_WORKER_KEEP_ALIVE_NS;
|
||||
|
||||
@JvmField
|
||||
public static final int MAX_POOL_SIZE;
|
||||
|
||||
@JvmField
|
||||
public static final TaskContext NonBlockingContext;
|
||||
public static final int TASK_NON_BLOCKING = 0;
|
||||
public static final int TASK_PROBABLY_BLOCKING = 1;
|
||||
|
||||
@JvmField
|
||||
public static final long WORK_STEALING_TIME_RESOLUTION_NS;
|
||||
|
||||
@JvmField
|
||||
public static SchedulerTimeSource schedulerTimeSource;
|
||||
|
||||
static {
|
||||
long systemProp$default;
|
||||
int systemProp$default2;
|
||||
int systemProp$default3;
|
||||
long systemProp$default4;
|
||||
systemProp$default = SystemPropsKt__SystemProps_commonKt.systemProp$default("kotlinx.coroutines.scheduler.resolution.ns", 100000L, 0L, 0L, 12, (Object) null);
|
||||
WORK_STEALING_TIME_RESOLUTION_NS = systemProp$default;
|
||||
systemProp$default2 = SystemPropsKt__SystemProps_commonKt.systemProp$default("kotlinx.coroutines.scheduler.core.pool.size", RangesKt.coerceAtLeast(SystemPropsKt.getAVAILABLE_PROCESSORS(), 2), 1, 0, 8, (Object) null);
|
||||
CORE_POOL_SIZE = systemProp$default2;
|
||||
systemProp$default3 = SystemPropsKt__SystemProps_commonKt.systemProp$default("kotlinx.coroutines.scheduler.max.pool.size", CoroutineScheduler.MAX_SUPPORTED_POOL_SIZE, 0, CoroutineScheduler.MAX_SUPPORTED_POOL_SIZE, 4, (Object) null);
|
||||
MAX_POOL_SIZE = systemProp$default3;
|
||||
TimeUnit timeUnit = TimeUnit.SECONDS;
|
||||
systemProp$default4 = SystemPropsKt__SystemProps_commonKt.systemProp$default("kotlinx.coroutines.scheduler.keep.alive.sec", 60L, 0L, 0L, 12, (Object) null);
|
||||
IDLE_WORKER_KEEP_ALIVE_NS = timeUnit.toNanos(systemProp$default4);
|
||||
schedulerTimeSource = NanoTimeSource.INSTANCE;
|
||||
NonBlockingContext = new TaskContextImpl(0);
|
||||
BlockingContext = new TaskContextImpl(1);
|
||||
}
|
||||
|
||||
public static final boolean isBlocking(Task task) {
|
||||
return task.taskContext.getTaskMode() == 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package kotlinx.coroutines.scheduling;
|
||||
|
||||
import kotlin.Metadata;
|
||||
import kotlin.coroutines.CoroutineContext;
|
||||
import kotlinx.coroutines.CoroutineDispatcher;
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi;
|
||||
import kotlinx.coroutines.InternalCoroutinesApi;
|
||||
import kotlinx.coroutines.internal.LimitedDispatcherKt;
|
||||
|
||||
@Metadata(d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0000\bÂ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u001c\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00062\n\u0010\u0007\u001a\u00060\bj\u0002`\tH\u0016J\u001c\u0010\n\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00062\n\u0010\u0007\u001a\u00060\bj\u0002`\tH\u0017J\u0010\u0010\u000b\u001a\u00020\u00012\u0006\u0010\f\u001a\u00020\rH\u0017¨\u0006\u000e"}, d2 = {"Lkotlinx/coroutines/scheduling/UnlimitedIoScheduler;", "Lkotlinx/coroutines/CoroutineDispatcher;", "()V", "dispatch", "", "context", "Lkotlin/coroutines/CoroutineContext;", "block", "Ljava/lang/Runnable;", "Lkotlinx/coroutines/Runnable;", "dispatchYield", "limitedParallelism", "parallelism", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
final class UnlimitedIoScheduler extends CoroutineDispatcher {
|
||||
public static final UnlimitedIoScheduler INSTANCE = new UnlimitedIoScheduler();
|
||||
|
||||
private UnlimitedIoScheduler() {
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.CoroutineDispatcher
|
||||
/* renamed from: dispatch */
|
||||
public void mo1685dispatch(CoroutineContext context, Runnable block) {
|
||||
DefaultScheduler.INSTANCE.dispatchWithContext$kotlinx_coroutines_core(block, TasksKt.BlockingContext, false);
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.CoroutineDispatcher
|
||||
@InternalCoroutinesApi
|
||||
public void dispatchYield(CoroutineContext context, Runnable block) {
|
||||
DefaultScheduler.INSTANCE.dispatchWithContext$kotlinx_coroutines_core(block, TasksKt.BlockingContext, true);
|
||||
}
|
||||
|
||||
@Override // kotlinx.coroutines.CoroutineDispatcher
|
||||
@ExperimentalCoroutinesApi
|
||||
public CoroutineDispatcher limitedParallelism(int parallelism) {
|
||||
LimitedDispatcherKt.checkParallelism(parallelism);
|
||||
return parallelism >= TasksKt.MAX_POOL_SIZE ? this : super.limitedParallelism(parallelism);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
package kotlinx.coroutines.scheduling;
|
||||
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
|
||||
import java.util.concurrent.atomic.AtomicReferenceArray;
|
||||
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.Ref;
|
||||
import kotlin.jvm.internal.SourceDebugExtension;
|
||||
|
||||
@Metadata(d1 = {"\u0000X\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\n\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0000\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u001a\u0010\u0012\u001a\u0004\u0018\u00010\u00072\u0006\u0010\u0013\u001a\u00020\u00072\b\b\u0002\u0010\u0014\u001a\u00020\u0015J\u0012\u0010\u0016\u001a\u0004\u0018\u00010\u00072\u0006\u0010\u0013\u001a\u00020\u0007H\u0002J\u000e\u0010\u0017\u001a\u00020\u00182\u0006\u0010\u0019\u001a\u00020\u001aJ\b\u0010\u001b\u001a\u0004\u0018\u00010\u0007J\b\u0010\u001c\u001a\u0004\u0018\u00010\u0007J\n\u0010\u001d\u001a\u0004\u0018\u00010\u0007H\u0002J\b\u0010\u001e\u001a\u0004\u0018\u00010\u0007J\u0010\u0010\u001f\u001a\u00020\u00152\u0006\u0010 \u001a\u00020\u001aH\u0002J\u0012\u0010!\u001a\u0004\u0018\u00010\u00072\u0006\u0010\"\u001a\u00020\u0015H\u0002J\u0016\u0010#\u001a\u0004\u0018\u00010\u00072\n\u0010$\u001a\u00060\tj\u0002`%H\u0002J\u001a\u0010&\u001a\u0004\u0018\u00010\u00072\u0006\u0010'\u001a\u00020\t2\u0006\u0010\"\u001a\u00020\u0015H\u0002J\"\u0010(\u001a\u00020)2\n\u0010$\u001a\u00060\tj\u0002`%2\u000e\u0010*\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00070+J$\u0010,\u001a\u00020)2\n\u0010$\u001a\u00060\tj\u0002`%2\u000e\u0010*\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00070+H\u0002J\u000e\u0010-\u001a\u00020\u0018*\u0004\u0018\u00010\u0007H\u0002R\t\u0010\u0003\u001a\u00020\u0004X\u0082\u0004R\u0016\u0010\u0005\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00070\u0006X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\b\u001a\u00020\t8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\n\u0010\u000bR\t\u0010\f\u001a\u00020\u0004X\u0082\u0004R\u0011\u0010\r\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00070\u000eX\u0082\u0004R\t\u0010\u000f\u001a\u00020\u0004X\u0082\u0004R\u0014\u0010\u0010\u001a\u00020\t8@X\u0080\u0004¢\u0006\u0006\u001a\u0004\b\u0011\u0010\u000b¨\u0006."}, d2 = {"Lkotlinx/coroutines/scheduling/WorkQueue;", "", "()V", "blockingTasksInBuffer", "Lkotlinx/atomicfu/AtomicInt;", "buffer", "Ljava/util/concurrent/atomic/AtomicReferenceArray;", "Lkotlinx/coroutines/scheduling/Task;", "bufferSize", "", "getBufferSize", "()I", "consumerIndex", "lastScheduledTask", "Lkotlinx/atomicfu/AtomicRef;", "producerIndex", "size", "getSize$kotlinx_coroutines_core", "add", "task", "fair", "", "addLast", "offloadAllWorkTo", "", "globalQueue", "Lkotlinx/coroutines/scheduling/GlobalQueue;", "poll", "pollBlocking", "pollBuffer", "pollCpu", "pollTo", "queue", "pollWithExclusiveMode", "onlyBlocking", "stealWithExclusiveMode", "stealingMode", "Lkotlinx/coroutines/scheduling/StealingMode;", "tryExtractFromTheMiddle", FirebaseAnalytics.Param.INDEX, "trySteal", "", "stolenTaskRef", "Lkotlin/jvm/internal/Ref$ObjectRef;", "tryStealLastScheduled", "decrementIfBlocking", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
||||
@SourceDebugExtension({"SMAP\nWorkQueue.kt\nKotlin\n*S Kotlin\n*F\n+ 1 WorkQueue.kt\nkotlinx/coroutines/scheduling/WorkQueue\n+ 2 Tasks.kt\nkotlinx/coroutines/scheduling/TasksKt\n+ 3 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 4 WorkQueue.kt\nkotlinx/coroutines/scheduling/WorkQueueKt\n*L\n1#1,255:1\n93#2:256\n93#2:257\n93#2:258\n93#2:261\n93#2:262\n1#3:259\n25#4:260\n*S KotlinDebug\n*F\n+ 1 WorkQueue.kt\nkotlinx/coroutines/scheduling/WorkQueue\n*L\n95#1:256\n162#1:257\n185#1:258\n205#1:261\n249#1:262\n205#1:260\n*E\n"})
|
||||
/* loaded from: classes3.dex */
|
||||
public final class WorkQueue {
|
||||
private volatile /* synthetic */ int blockingTasksInBuffer$volatile;
|
||||
private final AtomicReferenceArray<Task> buffer = new AtomicReferenceArray<>(128);
|
||||
private volatile /* synthetic */ int consumerIndex$volatile;
|
||||
private volatile /* synthetic */ Object lastScheduledTask$volatile;
|
||||
private volatile /* synthetic */ int producerIndex$volatile;
|
||||
private static final /* synthetic */ AtomicReferenceFieldUpdater lastScheduledTask$volatile$FU = AtomicReferenceFieldUpdater.newUpdater(WorkQueue.class, Object.class, "lastScheduledTask$volatile");
|
||||
private static final /* synthetic */ AtomicIntegerFieldUpdater producerIndex$volatile$FU = AtomicIntegerFieldUpdater.newUpdater(WorkQueue.class, "producerIndex$volatile");
|
||||
private static final /* synthetic */ AtomicIntegerFieldUpdater consumerIndex$volatile$FU = AtomicIntegerFieldUpdater.newUpdater(WorkQueue.class, "consumerIndex$volatile");
|
||||
private static final /* synthetic */ AtomicIntegerFieldUpdater blockingTasksInBuffer$volatile$FU = AtomicIntegerFieldUpdater.newUpdater(WorkQueue.class, "blockingTasksInBuffer$volatile");
|
||||
|
||||
public static /* synthetic */ Task add$default(WorkQueue workQueue, Task task, boolean z3, int i, Object obj) {
|
||||
if ((i & 2) != 0) {
|
||||
z3 = false;
|
||||
}
|
||||
return workQueue.add(task, z3);
|
||||
}
|
||||
|
||||
private final Task addLast(Task task) {
|
||||
if (getBufferSize() == 127) {
|
||||
return task;
|
||||
}
|
||||
if (task.taskContext.getTaskMode() == 1) {
|
||||
blockingTasksInBuffer$volatile$FU.incrementAndGet(this);
|
||||
}
|
||||
int i = producerIndex$volatile$FU.get(this) & WorkQueueKt.MASK;
|
||||
while (this.buffer.get(i) != null) {
|
||||
Thread.yield();
|
||||
}
|
||||
this.buffer.lazySet(i, task);
|
||||
producerIndex$volatile$FU.incrementAndGet(this);
|
||||
return null;
|
||||
}
|
||||
|
||||
private final void decrementIfBlocking(Task task) {
|
||||
if (task == null || task.taskContext.getTaskMode() != 1) {
|
||||
return;
|
||||
}
|
||||
blockingTasksInBuffer$volatile$FU.decrementAndGet(this);
|
||||
}
|
||||
|
||||
private final /* synthetic */ int getBlockingTasksInBuffer$volatile() {
|
||||
return this.blockingTasksInBuffer$volatile;
|
||||
}
|
||||
|
||||
private final int getBufferSize() {
|
||||
return producerIndex$volatile$FU.get(this) - consumerIndex$volatile$FU.get(this);
|
||||
}
|
||||
|
||||
private final /* synthetic */ int getConsumerIndex$volatile() {
|
||||
return this.consumerIndex$volatile;
|
||||
}
|
||||
|
||||
private final /* synthetic */ Object getLastScheduledTask$volatile() {
|
||||
return this.lastScheduledTask$volatile;
|
||||
}
|
||||
|
||||
private final /* synthetic */ int getProducerIndex$volatile() {
|
||||
return this.producerIndex$volatile;
|
||||
}
|
||||
|
||||
private final Task pollBuffer() {
|
||||
Task andSet;
|
||||
while (true) {
|
||||
int i = consumerIndex$volatile$FU.get(this);
|
||||
if (i - producerIndex$volatile$FU.get(this) == 0) {
|
||||
return null;
|
||||
}
|
||||
int i4 = i & WorkQueueKt.MASK;
|
||||
if (consumerIndex$volatile$FU.compareAndSet(this, i, i + 1) && (andSet = this.buffer.getAndSet(i4, null)) != null) {
|
||||
decrementIfBlocking(andSet);
|
||||
return andSet;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final boolean pollTo(GlobalQueue queue) {
|
||||
Task pollBuffer = pollBuffer();
|
||||
if (pollBuffer == null) {
|
||||
return false;
|
||||
}
|
||||
queue.addLast(pollBuffer);
|
||||
return true;
|
||||
}
|
||||
|
||||
private final Task pollWithExclusiveMode(boolean onlyBlocking) {
|
||||
while (true) {
|
||||
Task task = (Task) lastScheduledTask$volatile$FU.get(this);
|
||||
if (task != null) {
|
||||
if ((task.taskContext.getTaskMode() == 1) != onlyBlocking) {
|
||||
break;
|
||||
}
|
||||
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = lastScheduledTask$volatile$FU;
|
||||
while (!atomicReferenceFieldUpdater.compareAndSet(this, task, null)) {
|
||||
if (atomicReferenceFieldUpdater.get(this) != task) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return task;
|
||||
}
|
||||
break;
|
||||
}
|
||||
int i = consumerIndex$volatile$FU.get(this);
|
||||
int i4 = producerIndex$volatile$FU.get(this);
|
||||
while (i != i4) {
|
||||
if (onlyBlocking && blockingTasksInBuffer$volatile$FU.get(this) == 0) {
|
||||
return null;
|
||||
}
|
||||
i4--;
|
||||
Task tryExtractFromTheMiddle = tryExtractFromTheMiddle(i4, onlyBlocking);
|
||||
if (tryExtractFromTheMiddle != null) {
|
||||
return tryExtractFromTheMiddle;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private final /* synthetic */ void setBlockingTasksInBuffer$volatile(int i) {
|
||||
this.blockingTasksInBuffer$volatile = i;
|
||||
}
|
||||
|
||||
private final /* synthetic */ void setConsumerIndex$volatile(int i) {
|
||||
this.consumerIndex$volatile = i;
|
||||
}
|
||||
|
||||
private final /* synthetic */ void setLastScheduledTask$volatile(Object obj) {
|
||||
this.lastScheduledTask$volatile = obj;
|
||||
}
|
||||
|
||||
private final /* synthetic */ void setProducerIndex$volatile(int i) {
|
||||
this.producerIndex$volatile = i;
|
||||
}
|
||||
|
||||
private final Task stealWithExclusiveMode(int stealingMode) {
|
||||
int i = consumerIndex$volatile$FU.get(this);
|
||||
int i4 = producerIndex$volatile$FU.get(this);
|
||||
boolean z3 = stealingMode == 1;
|
||||
while (i != i4) {
|
||||
if (z3 && blockingTasksInBuffer$volatile$FU.get(this) == 0) {
|
||||
return null;
|
||||
}
|
||||
int i5 = i + 1;
|
||||
Task tryExtractFromTheMiddle = tryExtractFromTheMiddle(i, z3);
|
||||
if (tryExtractFromTheMiddle != null) {
|
||||
return tryExtractFromTheMiddle;
|
||||
}
|
||||
i = i5;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private final Task tryExtractFromTheMiddle(int index, boolean onlyBlocking) {
|
||||
int i = index & WorkQueueKt.MASK;
|
||||
Task task = this.buffer.get(i);
|
||||
if (task != null) {
|
||||
if ((task.taskContext.getTaskMode() == 1) == onlyBlocking) {
|
||||
AtomicReferenceArray<Task> atomicReferenceArray = this.buffer;
|
||||
while (!atomicReferenceArray.compareAndSet(i, task, null)) {
|
||||
if (atomicReferenceArray.get(i) != task) {
|
||||
}
|
||||
}
|
||||
if (onlyBlocking) {
|
||||
blockingTasksInBuffer$volatile$FU.decrementAndGet(this);
|
||||
}
|
||||
return task;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* JADX WARN: Type inference failed for: r0v2, types: [T, kotlinx.coroutines.scheduling.Task, java.lang.Object] */
|
||||
private final long tryStealLastScheduled(int stealingMode, Ref.ObjectRef<Task> stolenTaskRef) {
|
||||
while (true) {
|
||||
?? r02 = (Task) lastScheduledTask$volatile$FU.get(this);
|
||||
if (r02 == 0) {
|
||||
return -2L;
|
||||
}
|
||||
if (((r02.taskContext.getTaskMode() != 1 ? 2 : 1) & stealingMode) == 0) {
|
||||
return -2L;
|
||||
}
|
||||
long nanoTime = TasksKt.schedulerTimeSource.nanoTime() - r02.submissionTime;
|
||||
long j4 = TasksKt.WORK_STEALING_TIME_RESOLUTION_NS;
|
||||
if (nanoTime < j4) {
|
||||
return j4 - nanoTime;
|
||||
}
|
||||
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = lastScheduledTask$volatile$FU;
|
||||
while (!atomicReferenceFieldUpdater.compareAndSet(this, r02, null)) {
|
||||
if (atomicReferenceFieldUpdater.get(this) != r02) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
stolenTaskRef.element = r02;
|
||||
return -1L;
|
||||
}
|
||||
}
|
||||
|
||||
public final Task add(Task task, boolean fair) {
|
||||
if (fair) {
|
||||
return addLast(task);
|
||||
}
|
||||
Task task2 = (Task) lastScheduledTask$volatile$FU.getAndSet(this, task);
|
||||
if (task2 == null) {
|
||||
return null;
|
||||
}
|
||||
return addLast(task2);
|
||||
}
|
||||
|
||||
public final int getSize$kotlinx_coroutines_core() {
|
||||
Object obj = lastScheduledTask$volatile$FU.get(this);
|
||||
int bufferSize = getBufferSize();
|
||||
return obj != null ? bufferSize + 1 : bufferSize;
|
||||
}
|
||||
|
||||
public final void offloadAllWorkTo(GlobalQueue globalQueue) {
|
||||
Task task = (Task) lastScheduledTask$volatile$FU.getAndSet(this, null);
|
||||
if (task != null) {
|
||||
globalQueue.addLast(task);
|
||||
}
|
||||
do {
|
||||
} while (pollTo(globalQueue));
|
||||
}
|
||||
|
||||
public final Task poll() {
|
||||
Task task = (Task) lastScheduledTask$volatile$FU.getAndSet(this, null);
|
||||
return task == null ? pollBuffer() : task;
|
||||
}
|
||||
|
||||
public final Task pollBlocking() {
|
||||
return pollWithExclusiveMode(true);
|
||||
}
|
||||
|
||||
public final Task pollCpu() {
|
||||
return pollWithExclusiveMode(false);
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
public final long trySteal(int stealingMode, Ref.ObjectRef<Task> stolenTaskRef) {
|
||||
T pollBuffer = stealingMode == 3 ? pollBuffer() : stealWithExclusiveMode(stealingMode);
|
||||
if (pollBuffer == 0) {
|
||||
return tryStealLastScheduled(stealingMode, stolenTaskRef);
|
||||
}
|
||||
stolenTaskRef.element = pollBuffer;
|
||||
return -1L;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package kotlinx.coroutines.scheduling;
|
||||
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.SourceDebugExtension;
|
||||
|
||||
@Metadata(d1 = {"\u0000 \n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\"\u000e\u0010\u0000\u001a\u00020\u0001X\u0080T¢\u0006\u0002\n\u0000\"\u000e\u0010\u0002\u001a\u00020\u0001X\u0080T¢\u0006\u0002\n\u0000\"\u000e\u0010\u0003\u001a\u00020\u0001X\u0080T¢\u0006\u0002\n\u0000\"\u000e\u0010\u0004\u001a\u00020\u0005X\u0080T¢\u0006\u0002\n\u0000\"\u0012\u0010\u0006\u001a\u00060\u0001j\u0002`\u0007X\u0080T¢\u0006\u0002\n\u0000\"\u0012\u0010\b\u001a\u00060\u0001j\u0002`\u0007X\u0080T¢\u0006\u0002\n\u0000\"\u0012\u0010\t\u001a\u00060\u0001j\u0002`\u0007X\u0080T¢\u0006\u0002\n\u0000\"\u000e\u0010\n\u001a\u00020\u0005X\u0080T¢\u0006\u0002\n\u0000\"\u0019\u0010\u000b\u001a\u00020\u0001*\u00020\f8À\u0002X\u0080\u0004¢\u0006\u0006\u001a\u0004\b\r\u0010\u000e*\f\b\u0000\u0010\u000f\"\u00020\u00012\u00020\u0001¨\u0006\u0010"}, d2 = {"BUFFER_CAPACITY", "", "BUFFER_CAPACITY_BASE", "MASK", "NOTHING_TO_STEAL", "", "STEAL_ANY", "Lkotlinx/coroutines/scheduling/StealingMode;", "STEAL_BLOCKING_ONLY", "STEAL_CPU_ONLY", "TASK_STOLEN", "maskForStealingMode", "Lkotlinx/coroutines/scheduling/Task;", "getMaskForStealingMode", "(Lkotlinx/coroutines/scheduling/Task;)I", "StealingMode", "kotlinx-coroutines-core"}, k = 2, mv = {1, 9, 0}, xi = 48)
|
||||
@SourceDebugExtension({"SMAP\nWorkQueue.kt\nKotlin\n*S Kotlin\n*F\n+ 1 WorkQueue.kt\nkotlinx/coroutines/scheduling/WorkQueueKt\n+ 2 Tasks.kt\nkotlinx/coroutines/scheduling/TasksKt\n*L\n1#1,255:1\n93#2:256\n*S KotlinDebug\n*F\n+ 1 WorkQueue.kt\nkotlinx/coroutines/scheduling/WorkQueueKt\n*L\n25#1:256\n*E\n"})
|
||||
/* loaded from: classes3.dex */
|
||||
public final class WorkQueueKt {
|
||||
public static final int BUFFER_CAPACITY = 128;
|
||||
public static final int BUFFER_CAPACITY_BASE = 7;
|
||||
public static final int MASK = 127;
|
||||
public static final long NOTHING_TO_STEAL = -2;
|
||||
public static final int STEAL_ANY = 3;
|
||||
public static final int STEAL_BLOCKING_ONLY = 1;
|
||||
public static final int STEAL_CPU_ONLY = 2;
|
||||
public static final long TASK_STOLEN = -1;
|
||||
|
||||
public static final int getMaskForStealingMode(Task task) {
|
||||
return task.taskContext.getTaskMode() == 1 ? 1 : 2;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user