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:
2025-12-04 13:59:54 +01:00
parent f2fd1c3bf5
commit e0133d2ca2
10432 changed files with 1019085 additions and 1 deletions

View File

@@ -0,0 +1,63 @@
package kotlinx.coroutines.sync;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlinx.coroutines.selects.SelectClause2;
@Metadata(d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0010\u0002\n\u0002\b\u0004\bf\u0018\u00002\u00020\u0001J\u0010\u0010\u000b\u001a\u00020\u00032\u0006\u0010\f\u001a\u00020\u0001H&J\u001a\u0010\r\u001a\u00020\u000e2\n\b\u0002\u0010\f\u001a\u0004\u0018\u00010\u0001H¦@¢\u0006\u0002\u0010\u000fJ\u0014\u0010\u0010\u001a\u00020\u00032\n\b\u0002\u0010\f\u001a\u0004\u0018\u00010\u0001H&J\u0014\u0010\u0011\u001a\u00020\u000e2\n\b\u0002\u0010\f\u001a\u0004\u0018\u00010\u0001H&R\u0012\u0010\u0002\u001a\u00020\u0003X¦\u0004¢\u0006\u0006\u001a\u0004\b\u0002\u0010\u0004R(\u0010\u0005\u001a\u0010\u0012\u0006\u0012\u0004\u0018\u00010\u0001\u0012\u0004\u0012\u00020\u00000\u00068&X§\u0004¢\u0006\f\u0012\u0004\b\u0007\u0010\b\u001a\u0004\b\t\u0010\\u0006\u0012"}, d2 = {"Lkotlinx/coroutines/sync/Mutex;", "", "isLocked", "", "()Z", "onLock", "Lkotlinx/coroutines/selects/SelectClause2;", "getOnLock$annotations", "()V", "getOnLock", "()Lkotlinx/coroutines/selects/SelectClause2;", "holdsLock", "owner", "lock", "", "(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "tryLock", "unlock", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public interface Mutex {
@Metadata(k = 3, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public static final class DefaultImpls {
@Deprecated(level = DeprecationLevel.WARNING, message = "Mutex.onLock deprecated without replacement. For additional details please refer to #2794")
public static /* synthetic */ void getOnLock$annotations() {
}
public static /* synthetic */ Object lock$default(Mutex mutex, Object obj, Continuation continuation, int i, Object obj2) {
if (obj2 != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: lock");
}
if ((i & 1) != 0) {
obj = null;
}
return mutex.lock(obj, continuation);
}
public static /* synthetic */ boolean tryLock$default(Mutex mutex, Object obj, int i, Object obj2) {
if (obj2 != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: tryLock");
}
if ((i & 1) != 0) {
obj = null;
}
return mutex.tryLock(obj);
}
public static /* synthetic */ void unlock$default(Mutex mutex, Object obj, int i, Object obj2) {
if (obj2 != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: unlock");
}
if ((i & 1) != 0) {
obj = null;
}
mutex.unlock(obj);
}
}
SelectClause2<Object, Mutex> getOnLock();
boolean holdsLock(Object owner);
boolean isLocked();
Object lock(Object obj, Continuation<? super Unit> continuation);
boolean tryLock(Object owner);
void unlock(Object owner);
}

View File

@@ -0,0 +1,28 @@
package kotlinx.coroutines.sync;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function3;
import kotlin.jvm.internal.FunctionReferenceImpl;
import kotlinx.coroutines.selects.SelectInstance;
@Metadata(k = 3, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public /* synthetic */ class MutexImpl$onLock$1 extends FunctionReferenceImpl implements Function3<MutexImpl, SelectInstance<?>, Object, Unit> {
public static final MutexImpl$onLock$1 INSTANCE = new MutexImpl$onLock$1();
public MutexImpl$onLock$1() {
super(3, MutexImpl.class, "onLockRegFunction", "onLockRegFunction(Lkotlinx/coroutines/selects/SelectInstance;Ljava/lang/Object;)V", 0);
}
@Override // kotlin.jvm.functions.Function3
public /* bridge */ /* synthetic */ Unit invoke(MutexImpl mutexImpl, SelectInstance<?> selectInstance, Object obj) {
invoke2(mutexImpl, selectInstance, obj);
return Unit.INSTANCE;
}
/* renamed from: invoke, reason: avoid collision after fix types in other method */
public final void invoke2(MutexImpl mutexImpl, SelectInstance<?> selectInstance, Object obj) {
mutexImpl.onLockRegFunction(selectInstance, obj);
}
}

View File

@@ -0,0 +1,20 @@
package kotlinx.coroutines.sync;
import kotlin.Metadata;
import kotlin.jvm.functions.Function3;
import kotlin.jvm.internal.FunctionReferenceImpl;
@Metadata(k = 3, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public /* synthetic */ class MutexImpl$onLock$2 extends FunctionReferenceImpl implements Function3<MutexImpl, Object, Object, Object> {
public static final MutexImpl$onLock$2 INSTANCE = new MutexImpl$onLock$2();
public MutexImpl$onLock$2() {
super(3, MutexImpl.class, "onLockProcessResult", "onLockProcessResult(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", 0);
}
@Override // kotlin.jvm.functions.Function3
public final Object invoke(MutexImpl mutexImpl, Object obj, Object obj2) {
return mutexImpl.onLockProcessResult(obj, obj2);
}
}

View File

@@ -0,0 +1,431 @@
package kotlinx.coroutines.sync;
import com.google.android.gms.measurement.api.AppMeasurementSdk;
import com.google.firebase.analytics.FirebaseAnalytics;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugProbesKt;
import kotlin.jvm.JvmField;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function3;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.jvm.internal.TypeIntrinsics;
import kotlinx.coroutines.CancellableContinuation;
import kotlinx.coroutines.CancellableContinuationImpl;
import kotlinx.coroutines.CancellableContinuationKt;
import kotlinx.coroutines.CoroutineDispatcher;
import kotlinx.coroutines.DebugStringsKt;
import kotlinx.coroutines.DisposableHandle;
import kotlinx.coroutines.ExperimentalCoroutinesApi;
import kotlinx.coroutines.InternalCoroutinesApi;
import kotlinx.coroutines.Waiter;
import kotlinx.coroutines.internal.Segment;
import kotlinx.coroutines.internal.Symbol;
import kotlinx.coroutines.selects.SelectClause2;
import kotlinx.coroutines.selects.SelectClause2Impl;
import kotlinx.coroutines.selects.SelectInstance;
import kotlinx.coroutines.selects.SelectInstanceInternal;
@Metadata(d1 = {"\u0000\\\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\u0010\u0003\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0007\n\u0002\u0010\u000e\n\u0002\b\u0006\b\u0010\u0018\u00002\u00020\u00012\u00020\u0002:\u0002+,B\r\u0012\u0006\u0010\u0003\u001a\u00020\u0004¢\u0006\u0002\u0010\u0005J\u0010\u0010\u001d\u001a\u00020\u00042\u0006\u0010\u001b\u001a\u00020\nH\u0016J\u0012\u0010\u001e\u001a\u00020\u001f2\b\u0010\u001b\u001a\u0004\u0018\u00010\nH\u0002J\u0018\u0010 \u001a\u00020\u00192\b\u0010\u001b\u001a\u0004\u0018\u00010\nH\u0096@¢\u0006\u0002\u0010!J\u0018\u0010\"\u001a\u00020\u00192\b\u0010\u001b\u001a\u0004\u0018\u00010\nH\u0082@¢\u0006\u0002\u0010!J\u001e\u0010#\u001a\u0004\u0018\u00010\n2\b\u0010\u001b\u001a\u0004\u0018\u00010\n2\b\u0010$\u001a\u0004\u0018\u00010\nH\u0014J\u001e\u0010%\u001a\u00020\u00192\n\u0010\u0014\u001a\u0006\u0012\u0002\b\u00030\u00112\b\u0010\u001b\u001a\u0004\u0018\u00010\nH\u0014J\b\u0010&\u001a\u00020'H\u0016J\u0012\u0010(\u001a\u00020\u00042\b\u0010\u001b\u001a\u0004\u0018\u00010\nH\u0016J\u0012\u0010)\u001a\u00020\u001f2\b\u0010\u001b\u001a\u0004\u0018\u00010\nH\u0002J\u0012\u0010*\u001a\u00020\u00192\b\u0010\u001b\u001a\u0004\u0018\u00010\nH\u0016R\u0014\u0010\u0006\u001a\u00020\u00048VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u0006\u0010\u0007R(\u0010\b\u001a\u0010\u0012\u0006\u0012\u0004\u0018\u00010\n\u0012\u0004\u0012\u00020\u00020\t8VX\u0096\u0004¢\u0006\f\u0012\u0004\b\u000b\u0010\f\u001a\u0004\b\r\u0010\u000eRk\u0010\u000f\u001a_\u0012\u0017\u0012\u0015\u0012\u0002\b\u00030\u0011¢\u0006\f\b\u0012\u0012\b\b\u0013\u0012\u0004\b\b(\u0014\u0012\u0015\u0012\u0013\u0018\u00010\\u0006\f\b\u0012\u0012\b\b\u0013\u0012\u0004\b\b(\u0015\u0012\u0015\u0012\u0013\u0018\u00010\\u0006\f\b\u0012\u0012\b\b\u0013\u0012\u0004\b\b(\u0016\u0012\u0010\u0012\u000e\u0012\u0004\u0012\u00020\u0018\u0012\u0004\u0012\u00020\u00190\u00170\u0010j\u0002`\u001aX\u0082\u0004¢\u0006\u0002\n\u0000R\u0011\u0010\u001b\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\n0\u001cX\u0082\u0004¨\u0006-"}, d2 = {"Lkotlinx/coroutines/sync/MutexImpl;", "Lkotlinx/coroutines/sync/SemaphoreImpl;", "Lkotlinx/coroutines/sync/Mutex;", "locked", "", "(Z)V", "isLocked", "()Z", "onLock", "Lkotlinx/coroutines/selects/SelectClause2;", "", "getOnLock$annotations", "()V", "getOnLock", "()Lkotlinx/coroutines/selects/SelectClause2;", "onSelectCancellationUnlockConstructor", "Lkotlin/Function3;", "Lkotlinx/coroutines/selects/SelectInstance;", "Lkotlin/ParameterName;", AppMeasurementSdk.ConditionalUserProperty.NAME, "select", "param", "internalResult", "Lkotlin/Function1;", "", "", "Lkotlinx/coroutines/selects/OnCancellationConstructor;", "owner", "Lkotlinx/atomicfu/AtomicRef;", "holdsLock", "holdsLockImpl", "", "lock", "(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "lockSuspend", "onLockProcessResult", "result", "onLockRegFunction", "toString", "", "tryLock", "tryLockImpl", "unlock", "CancellableContinuationWithOwner", "SelectInstanceWithOwner", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nMutex.kt\nKotlin\n*S Kotlin\n*F\n+ 1 Mutex.kt\nkotlinx/coroutines/sync/MutexImpl\n+ 2 CancellableContinuation.kt\nkotlinx/coroutines/CancellableContinuationKt\n+ 3 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,316:1\n332#2,12:317\n1#3:329\n*S KotlinDebug\n*F\n+ 1 Mutex.kt\nkotlinx/coroutines/sync/MutexImpl\n*L\n181#1:317,12\n*E\n"})
/* loaded from: classes3.dex */
public class MutexImpl extends SemaphoreImpl implements Mutex {
private static final /* synthetic */ AtomicReferenceFieldUpdater owner$volatile$FU = AtomicReferenceFieldUpdater.newUpdater(MutexImpl.class, Object.class, "owner$volatile");
private final Function3<SelectInstance<?>, Object, Object, Function1<Throwable, Unit>> onSelectCancellationUnlockConstructor;
private volatile /* synthetic */ Object owner$volatile;
@Metadata(d1 = {"\u0000f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u0005\n\u0002\u0010\u0003\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0082\u0004\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u00012\u00020\u0003B\u001d\u0012\f\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00020\u0005\u0012\b\u0010\u0006\u001a\u0004\u0018\u00010\u0007¢\u0006\u0002\u0010\bJ\u0015\u0010\u0012\u001a\u00020\u000e2\n\b\u0002\u0010\u0013\u001a\u0004\u0018\u00010\u0014H\u0096\u0001J\u0011\u0010\u0015\u001a\u00020\u00022\u0006\u0010\u0016\u001a\u00020\u0007H\u0097\u0001J\t\u0010\u0017\u001a\u00020\u0002H\u0097\u0001J2\u0010\u0018\u001a\u00020\u00022'\u0010\u0019\u001a#\u0012\u0015\u0012\u0013\u0018\u00010\u0014¢\u0006\f\b\u001b\u0012\b\b\u001c\u0012\u0004\b\b(\u0013\u0012\u0004\u0012\u00020\u00020\u001aj\u0002`\u001dH\u0096\u0001J\u001d\u0010\u0018\u001a\u00020\u00022\n\u0010\u001e\u001a\u0006\u0012\u0002\b\u00030\u001f2\u0006\u0010 \u001a\u00020!H\u0096\u0001J:\u0010\"\u001a\u00020\u00022\u0006\u0010#\u001a\u00020\u00022#\u0010$\u001a\u001f\u0012\u0013\u0012\u00110\u0014¢\u0006\f\b\u001b\u0012\b\b\u001c\u0012\u0004\b\b(\u0013\u0012\u0004\u0012\u00020\u0002\u0018\u00010\u001aH\u0016¢\u0006\u0002\u0010%J\u001c\u0010&\u001a\u00020\u00022\f\u0010'\u001a\b\u0012\u0004\u0012\u00020\u00020(H\u0096\u0001¢\u0006\u0002\u0010)J$\u0010*\u001a\u0004\u0018\u00010\u00072\u0006\u0010#\u001a\u00020\u00022\n\b\u0002\u0010+\u001a\u0004\u0018\u00010\u0007H\u0097\u0001¢\u0006\u0002\u0010,JF\u0010*\u001a\u0004\u0018\u00010\u00072\u0006\u0010#\u001a\u00020\u00022\b\u0010+\u001a\u0004\u0018\u00010\u00072#\u0010$\u001a\u001f\u0012\u0013\u0012\u00110\u0014¢\u0006\f\b\u001b\u0012\b\b\u001c\u0012\u0004\b\b(\u0013\u0012\u0004\u0012\u00020\u0002\u0018\u00010\u001aH\u0016¢\u0006\u0002\u0010-J\u0013\u0010.\u001a\u0004\u0018\u00010\u00072\u0006\u0010/\u001a\u00020\u0014H\u0097\u0001J\u001a\u00100\u001a\u00020\u0002*\u0002012\u0006\u0010#\u001a\u00020\u0002H\u0097\u0001¢\u0006\u0002\u00102J\u0015\u00103\u001a\u00020\u0002*\u0002012\u0006\u0010/\u001a\u00020\u0014H\u0097\u0001R\u0016\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00020\u00058\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u0012\u0010\t\u001a\u00020\nX\u0096\u0005¢\u0006\u0006\u001a\u0004\b\u000b\u0010\fR\u0012\u0010\r\u001a\u00020\u000eX\u0096\u0005¢\u0006\u0006\u001a\u0004\b\r\u0010\u000fR\u0012\u0010\u0010\u001a\u00020\u000eX\u0096\u0005¢\u0006\u0006\u001a\u0004\b\u0010\u0010\u000fR\u0012\u0010\u0011\u001a\u00020\u000eX\u0096\u0005¢\u0006\u0006\u001a\u0004\b\u0011\u0010\u000fR\u0012\u0010\u0006\u001a\u0004\u0018\u00010\u00078\u0006X\u0087\u0004¢\u0006\u0002\n\u0000¨\u00064"}, d2 = {"Lkotlinx/coroutines/sync/MutexImpl$CancellableContinuationWithOwner;", "Lkotlinx/coroutines/CancellableContinuation;", "", "Lkotlinx/coroutines/Waiter;", "cont", "Lkotlinx/coroutines/CancellableContinuationImpl;", "owner", "", "(Lkotlinx/coroutines/sync/MutexImpl;Lkotlinx/coroutines/CancellableContinuationImpl;Ljava/lang/Object;)V", "context", "Lkotlin/coroutines/CoroutineContext;", "getContext", "()Lkotlin/coroutines/CoroutineContext;", "isActive", "", "()Z", "isCancelled", "isCompleted", "cancel", "cause", "", "completeResume", "token", "initCancellability", "invokeOnCancellation", "handler", "Lkotlin/Function1;", "Lkotlin/ParameterName;", AppMeasurementSdk.ConditionalUserProperty.NAME, "Lkotlinx/coroutines/CompletionHandler;", "segment", "Lkotlinx/coroutines/internal/Segment;", FirebaseAnalytics.Param.INDEX, "", "resume", "value", "onCancellation", "(Lkotlin/Unit;Lkotlin/jvm/functions/Function1;)V", "resumeWith", "result", "Lkotlin/Result;", "(Ljava/lang/Object;)V", "tryResume", "idempotent", "(Lkotlin/Unit;Ljava/lang/Object;)Ljava/lang/Object;", "(Lkotlin/Unit;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;", "tryResumeWithException", "exception", "resumeUndispatched", "Lkotlinx/coroutines/CoroutineDispatcher;", "(Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/Unit;)V", "resumeUndispatchedWithException", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nMutex.kt\nKotlin\n*S Kotlin\n*F\n+ 1 Mutex.kt\nkotlinx/coroutines/sync/MutexImpl$CancellableContinuationWithOwner\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,316:1\n1#2:317\n*E\n"})
/* loaded from: classes3.dex */
public final class CancellableContinuationWithOwner implements CancellableContinuation<Unit>, Waiter {
@JvmField
public final CancellableContinuationImpl<Unit> cont;
@JvmField
public final Object owner;
/* JADX WARN: Multi-variable type inference failed */
public CancellableContinuationWithOwner(CancellableContinuationImpl<? super Unit> cancellableContinuationImpl, Object obj) {
this.cont = cancellableContinuationImpl;
this.owner = obj;
}
@Override // kotlinx.coroutines.CancellableContinuation
public boolean cancel(Throwable cause) {
return this.cont.cancel(cause);
}
@Override // kotlinx.coroutines.CancellableContinuation
@InternalCoroutinesApi
public void completeResume(Object token) {
this.cont.completeResume(token);
}
@Override // kotlin.coroutines.Continuation
/* renamed from: getContext */
public CoroutineContext get$context() {
return this.cont.get$context();
}
@Override // kotlinx.coroutines.CancellableContinuation
@InternalCoroutinesApi
public void initCancellability() {
this.cont.initCancellability();
}
@Override // kotlinx.coroutines.CancellableContinuation
public void invokeOnCancellation(Function1<? super Throwable, Unit> handler) {
this.cont.invokeOnCancellation(handler);
}
@Override // kotlinx.coroutines.CancellableContinuation
public boolean isActive() {
return this.cont.isActive();
}
@Override // kotlinx.coroutines.CancellableContinuation
public boolean isCancelled() {
return this.cont.isCancelled();
}
@Override // kotlinx.coroutines.CancellableContinuation
public boolean isCompleted() {
return this.cont.isCompleted();
}
@Override // kotlinx.coroutines.CancellableContinuation
public /* bridge */ /* synthetic */ void resume(Unit unit, Function1 function1) {
resume2(unit, (Function1<? super Throwable, Unit>) function1);
}
@Override // kotlinx.coroutines.CancellableContinuation
@ExperimentalCoroutinesApi
public void resumeUndispatched(CoroutineDispatcher coroutineDispatcher, Unit unit) {
this.cont.resumeUndispatched(coroutineDispatcher, unit);
}
@Override // kotlinx.coroutines.CancellableContinuation
@ExperimentalCoroutinesApi
public void resumeUndispatchedWithException(CoroutineDispatcher coroutineDispatcher, Throwable th) {
this.cont.resumeUndispatchedWithException(coroutineDispatcher, th);
}
@Override // kotlin.coroutines.Continuation
public void resumeWith(Object result) {
this.cont.resumeWith(result);
}
@Override // kotlinx.coroutines.CancellableContinuation
@InternalCoroutinesApi
public Object tryResume(Unit value, Object idempotent) {
return this.cont.tryResume(value, idempotent);
}
@Override // kotlinx.coroutines.CancellableContinuation
@InternalCoroutinesApi
public Object tryResumeWithException(Throwable exception) {
return this.cont.tryResumeWithException(exception);
}
@Override // kotlinx.coroutines.Waiter
public void invokeOnCancellation(Segment<?> segment, int index) {
this.cont.invokeOnCancellation(segment, index);
}
/* renamed from: resume, reason: avoid collision after fix types in other method */
public void resume2(Unit value, Function1<? super Throwable, Unit> onCancellation) {
MutexImpl.access$getOwner$volatile$FU().set(MutexImpl.this, this.owner);
CancellableContinuationImpl<Unit> cancellableContinuationImpl = this.cont;
final MutexImpl mutexImpl = MutexImpl.this;
cancellableContinuationImpl.resume(value, new Function1<Throwable, Unit>() { // from class: kotlinx.coroutines.sync.MutexImpl$CancellableContinuationWithOwner$resume$2
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(Throwable th) {
invoke2(th);
return Unit.INSTANCE;
}
/* renamed from: invoke, reason: avoid collision after fix types in other method */
public final void invoke2(Throwable th) {
MutexImpl.this.unlock(this.owner);
}
});
}
@Override // kotlinx.coroutines.CancellableContinuation
public /* bridge */ /* synthetic */ Object tryResume(Unit unit, Object obj, Function1 function1) {
return tryResume2(unit, obj, (Function1<? super Throwable, Unit>) function1);
}
/* renamed from: tryResume, reason: avoid collision after fix types in other method */
public Object tryResume2(Unit value, Object idempotent, Function1<? super Throwable, Unit> onCancellation) {
final MutexImpl mutexImpl = MutexImpl.this;
Object tryResume = this.cont.tryResume(value, idempotent, new Function1<Throwable, Unit>() { // from class: kotlinx.coroutines.sync.MutexImpl$CancellableContinuationWithOwner$tryResume$token$1
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(Throwable th) {
invoke2(th);
return Unit.INSTANCE;
}
/* renamed from: invoke, reason: avoid collision after fix types in other method */
public final void invoke2(Throwable th) {
MutexImpl.access$getOwner$volatile$FU().set(MutexImpl.this, this.owner);
MutexImpl.this.unlock(this.owner);
}
});
if (tryResume != null) {
MutexImpl.access$getOwner$volatile$FU().set(MutexImpl.this, this.owner);
}
return tryResume;
}
}
@Metadata(d1 = {"\u0000B\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u0003\b\u0082\u0004\u0018\u0000*\u0004\b\u0000\u0010\u00012\b\u0012\u0004\u0012\u0002H\u00010\u0002B\u001d\u0012\f\u0010\u0003\u001a\b\u0012\u0004\u0012\u00028\u00000\u0002\u0012\b\u0010\u0004\u001a\u0004\u0018\u00010\u0005¢\u0006\u0002\u0010\u0006J\u0011\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\u000eH\u0096\u0001J\u001d\u0010\u000f\u001a\u00020\f2\n\u0010\u0010\u001a\u0006\u0012\u0002\b\u00030\u00112\u0006\u0010\u0012\u001a\u00020\u0013H\u0096\u0001J\u0012\u0010\u0014\u001a\u00020\f2\b\u0010\u0015\u001a\u0004\u0018\u00010\u0005H\u0016J\u001a\u0010\u0016\u001a\u00020\u00172\u0006\u0010\u0018\u001a\u00020\u00052\b\u0010\u0019\u001a\u0004\u0018\u00010\u0005H\u0016R\u0012\u0010\u0007\u001a\u00020\bX\u0096\u0005¢\u0006\u0006\u001a\u0004\b\t\u0010\nR\u0012\u0010\u0004\u001a\u0004\u0018\u00010\u00058\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u0016\u0010\u0003\u001a\b\u0012\u0004\u0012\u00028\u00000\u00028\u0006X\u0087\u0004¢\u0006\u0002\n\u0000¨\u0006\u001a"}, d2 = {"Lkotlinx/coroutines/sync/MutexImpl$SelectInstanceWithOwner;", "Q", "Lkotlinx/coroutines/selects/SelectInstanceInternal;", "select", "owner", "", "(Lkotlinx/coroutines/sync/MutexImpl;Lkotlinx/coroutines/selects/SelectInstanceInternal;Ljava/lang/Object;)V", "context", "Lkotlin/coroutines/CoroutineContext;", "getContext", "()Lkotlin/coroutines/CoroutineContext;", "disposeOnCompletion", "", "disposableHandle", "Lkotlinx/coroutines/DisposableHandle;", "invokeOnCancellation", "segment", "Lkotlinx/coroutines/internal/Segment;", FirebaseAnalytics.Param.INDEX, "", "selectInRegistrationPhase", "internalResult", "trySelect", "", "clauseObject", "result", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nMutex.kt\nKotlin\n*S Kotlin\n*F\n+ 1 Mutex.kt\nkotlinx/coroutines/sync/MutexImpl$SelectInstanceWithOwner\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,316:1\n1#2:317\n*E\n"})
/* loaded from: classes3.dex */
public final class SelectInstanceWithOwner<Q> implements SelectInstanceInternal<Q> {
@JvmField
public final Object owner;
@JvmField
public final SelectInstanceInternal<Q> select;
public SelectInstanceWithOwner(SelectInstanceInternal<Q> selectInstanceInternal, Object obj) {
this.select = selectInstanceInternal;
this.owner = obj;
}
@Override // kotlinx.coroutines.selects.SelectInstance
public void disposeOnCompletion(DisposableHandle disposableHandle) {
this.select.disposeOnCompletion(disposableHandle);
}
@Override // kotlinx.coroutines.selects.SelectInstance
public CoroutineContext getContext() {
return this.select.getContext();
}
@Override // kotlinx.coroutines.Waiter
public void invokeOnCancellation(Segment<?> segment, int index) {
this.select.invokeOnCancellation(segment, index);
}
@Override // kotlinx.coroutines.selects.SelectInstance
public void selectInRegistrationPhase(Object internalResult) {
MutexImpl.access$getOwner$volatile$FU().set(MutexImpl.this, this.owner);
this.select.selectInRegistrationPhase(internalResult);
}
@Override // kotlinx.coroutines.selects.SelectInstance
public boolean trySelect(Object clauseObject, Object result) {
boolean trySelect = this.select.trySelect(clauseObject, result);
MutexImpl mutexImpl = MutexImpl.this;
if (trySelect) {
MutexImpl.access$getOwner$volatile$FU().set(mutexImpl, this.owner);
}
return trySelect;
}
}
public MutexImpl(boolean z3) {
super(1, z3 ? 1 : 0);
this.owner$volatile = z3 ? null : MutexKt.NO_OWNER;
this.onSelectCancellationUnlockConstructor = new Function3<SelectInstance<?>, Object, Object, Function1<? super Throwable, ? extends Unit>>() { // from class: kotlinx.coroutines.sync.MutexImpl$onSelectCancellationUnlockConstructor$1
{
super(3);
}
@Override // kotlin.jvm.functions.Function3
public final Function1<Throwable, Unit> invoke(SelectInstance<?> selectInstance, final Object obj, Object obj2) {
final MutexImpl mutexImpl = MutexImpl.this;
return new Function1<Throwable, Unit>() { // from class: kotlinx.coroutines.sync.MutexImpl$onSelectCancellationUnlockConstructor$1.1
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(Throwable th) {
invoke2(th);
return Unit.INSTANCE;
}
/* renamed from: invoke, reason: avoid collision after fix types in other method */
public final void invoke2(Throwable th) {
MutexImpl.this.unlock(obj);
}
};
}
};
}
public static final /* synthetic */ AtomicReferenceFieldUpdater access$getOwner$volatile$FU() {
return owner$volatile$FU;
}
public static /* synthetic */ void getOnLock$annotations() {
}
private final /* synthetic */ Object getOwner$volatile() {
return this.owner$volatile;
}
private final int holdsLockImpl(Object owner) {
Symbol symbol;
while (isLocked()) {
Object obj = owner$volatile$FU.get(this);
symbol = MutexKt.NO_OWNER;
if (obj != symbol) {
return obj == owner ? 1 : 2;
}
}
return 0;
}
public static /* synthetic */ Object lock$suspendImpl(MutexImpl mutexImpl, Object obj, Continuation<? super Unit> continuation) {
Object lockSuspend;
return (!mutexImpl.tryLock(obj) && (lockSuspend = mutexImpl.lockSuspend(obj, continuation)) == IntrinsicsKt.getCOROUTINE_SUSPENDED()) ? lockSuspend : Unit.INSTANCE;
}
/* JADX INFO: Access modifiers changed from: private */
public final Object lockSuspend(Object obj, Continuation<? super Unit> continuation) {
CancellableContinuationImpl orCreateCancellableContinuation = CancellableContinuationKt.getOrCreateCancellableContinuation(IntrinsicsKt.intercepted(continuation));
try {
acquire((CancellableContinuation<? super Unit>) new CancellableContinuationWithOwner(orCreateCancellableContinuation, obj));
Object result = orCreateCancellableContinuation.getResult();
if (result == IntrinsicsKt.getCOROUTINE_SUSPENDED()) {
DebugProbesKt.probeCoroutineSuspended(continuation);
}
return result == IntrinsicsKt.getCOROUTINE_SUSPENDED() ? result : Unit.INSTANCE;
} catch (Throwable th) {
orCreateCancellableContinuation.releaseClaimedReusableContinuation$kotlinx_coroutines_core();
throw th;
}
}
private final /* synthetic */ void setOwner$volatile(Object obj) {
this.owner$volatile = obj;
}
private final int tryLockImpl(Object owner) {
while (!tryAcquire()) {
if (owner == null) {
return 1;
}
int holdsLockImpl = holdsLockImpl(owner);
if (holdsLockImpl == 1) {
return 2;
}
if (holdsLockImpl == 2) {
return 1;
}
}
owner$volatile$FU.set(this, owner);
return 0;
}
@Override // kotlinx.coroutines.sync.Mutex
public SelectClause2<Object, Mutex> getOnLock() {
MutexImpl$onLock$1 mutexImpl$onLock$1 = MutexImpl$onLock$1.INSTANCE;
Intrinsics.checkNotNull(mutexImpl$onLock$1, "null cannot be cast to non-null type kotlin.Function3<@[ParameterName(name = 'clauseObject')] kotlin.Any, @[ParameterName(name = 'select')] kotlinx.coroutines.selects.SelectInstance<*>, @[ParameterName(name = 'param')] kotlin.Any?, kotlin.Unit>{ kotlinx.coroutines.selects.SelectKt.RegistrationFunction }");
Function3 function3 = (Function3) TypeIntrinsics.beforeCheckcastToFunctionOfArity(mutexImpl$onLock$1, 3);
MutexImpl$onLock$2 mutexImpl$onLock$2 = MutexImpl$onLock$2.INSTANCE;
Intrinsics.checkNotNull(mutexImpl$onLock$2, "null cannot be cast to non-null type kotlin.Function3<@[ParameterName(name = 'clauseObject')] kotlin.Any, @[ParameterName(name = 'param')] kotlin.Any?, @[ParameterName(name = 'clauseResult')] kotlin.Any?, kotlin.Any?>{ kotlinx.coroutines.selects.SelectKt.ProcessResultFunction }");
return new SelectClause2Impl(this, function3, (Function3) TypeIntrinsics.beforeCheckcastToFunctionOfArity(mutexImpl$onLock$2, 3), this.onSelectCancellationUnlockConstructor);
}
@Override // kotlinx.coroutines.sync.Mutex
public boolean holdsLock(Object owner) {
return holdsLockImpl(owner) == 1;
}
@Override // kotlinx.coroutines.sync.Mutex
public boolean isLocked() {
return getAvailablePermits() == 0;
}
@Override // kotlinx.coroutines.sync.Mutex
public Object lock(Object obj, Continuation<? super Unit> continuation) {
return lock$suspendImpl(this, obj, continuation);
}
public Object onLockProcessResult(Object owner, Object result) {
Symbol symbol;
symbol = MutexKt.ON_LOCK_ALREADY_LOCKED_BY_OWNER;
if (!Intrinsics.areEqual(result, symbol)) {
return this;
}
throw new IllegalStateException(("This mutex is already locked by the specified owner: " + owner).toString());
}
public void onLockRegFunction(SelectInstance<?> select, Object owner) {
Symbol symbol;
if (owner == null || !holdsLock(owner)) {
Intrinsics.checkNotNull(select, "null cannot be cast to non-null type kotlinx.coroutines.selects.SelectInstanceInternal<*>");
onAcquireRegFunction(new SelectInstanceWithOwner((SelectInstanceInternal) select, owner), owner);
} else {
symbol = MutexKt.ON_LOCK_ALREADY_LOCKED_BY_OWNER;
select.selectInRegistrationPhase(symbol);
}
}
public String toString() {
return "Mutex@" + DebugStringsKt.getHexAddress(this) + "[isLocked=" + isLocked() + ",owner=" + owner$volatile$FU.get(this) + ']';
}
@Override // kotlinx.coroutines.sync.Mutex
public boolean tryLock(Object owner) {
int tryLockImpl = tryLockImpl(owner);
if (tryLockImpl == 0) {
return true;
}
if (tryLockImpl == 1) {
return false;
}
if (tryLockImpl != 2) {
throw new IllegalStateException("unexpected");
}
throw new IllegalStateException(("This mutex is already locked by the specified owner: " + owner).toString());
}
@Override // kotlinx.coroutines.sync.Mutex
public void unlock(Object owner) {
Symbol symbol;
Symbol symbol2;
while (isLocked()) {
Object obj = owner$volatile$FU.get(this);
symbol = MutexKt.NO_OWNER;
if (obj != symbol) {
if (obj != owner && owner != null) {
throw new IllegalStateException(("This mutex is locked by " + obj + ", but " + owner + " is expected").toString());
}
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = owner$volatile$FU;
symbol2 = MutexKt.NO_OWNER;
while (!atomicReferenceFieldUpdater.compareAndSet(this, obj, symbol2)) {
if (atomicReferenceFieldUpdater.get(this) != obj) {
break;
}
}
release();
return;
}
}
throw new IllegalStateException("This mutex is not locked");
}
}

View File

@@ -0,0 +1,31 @@
package kotlinx.coroutines.sync;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.ContinuationImpl;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.jvm.internal.IntCompanionObject;
import kotlin.jvm.internal.SourceDebugExtension;
@Metadata(k = 3, mv = {1, 9, 0}, xi = 176)
@DebugMetadata(c = "kotlinx.coroutines.sync.MutexKt", f = "Mutex.kt", i = {0, 0, 0}, l = {128}, m = "withLock", n = {"$this$withLock", "owner", "action"}, s = {"L$0", "L$1", "L$2"})
@SourceDebugExtension({"SMAP\nMutex.kt\nKotlin\n*S Kotlin\n*F\n+ 1 Mutex.kt\nkotlinx/coroutines/sync/MutexKt$withLock$1\n*L\n1#1,316:1\n*E\n"})
/* loaded from: classes3.dex */
public final class MutexKt$withLock$1<T> extends ContinuationImpl {
Object L$0;
Object L$1;
Object L$2;
int label;
/* synthetic */ Object result;
public MutexKt$withLock$1(Continuation<? super MutexKt$withLock$1> continuation) {
super(continuation);
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
this.result = obj;
this.label |= IntCompanionObject.MIN_VALUE;
return MutexKt.withLock(null, null, null, this);
}
}

View File

@@ -0,0 +1,119 @@
package kotlinx.coroutines.sync;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.InlineMarker;
import kotlinx.coroutines.internal.Symbol;
@Metadata(d1 = {"\u0000.\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u001a\u0010\u0010\n\u001a\u00020\u000b2\b\b\u0002\u0010\f\u001a\u00020\r\u001a?\u0010\u000e\u001a\u0002H\u000f\"\u0004\b\u0000\u0010\u000f*\u00020\u000b2\n\b\u0002\u0010\u0010\u001a\u0004\u0018\u00010\u00112\f\u0010\u0012\u001a\b\u0012\u0004\u0012\u0002H\u000f0\u0013H\u0086H\u0082\u0002\n\n\b\b\u0001\u0012\u0002\u0010\u0002 \u0001¢\u0006\u0002\u0010\u0014\"\u000e\u0010\u0000\u001a\u00020\u0001X\u0082T¢\u0006\u0002\n\u0000\"\u000e\u0010\u0002\u001a\u00020\u0001X\u0082T¢\u0006\u0002\n\u0000\"\u000e\u0010\u0003\u001a\u00020\u0001X\u0082T¢\u0006\u0002\n\u0000\"\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000\"\u000e\u0010\u0006\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000\"\u000e\u0010\u0007\u001a\u00020\u0001X\u0082T¢\u0006\u0002\n\u0000\"\u000e\u0010\b\u001a\u00020\u0001X\u0082T¢\u0006\u0002\n\u0000\"\u000e\u0010\t\u001a\u00020\u0001X\u0082T¢\u0006\u0002\n\u0000¨\u0006\u0015"}, d2 = {"HOLDS_LOCK_ANOTHER_OWNER", "", "HOLDS_LOCK_UNLOCKED", "HOLDS_LOCK_YES", "NO_OWNER", "Lkotlinx/coroutines/internal/Symbol;", "ON_LOCK_ALREADY_LOCKED_BY_OWNER", "TRY_LOCK_ALREADY_LOCKED_BY_OWNER", "TRY_LOCK_FAILED", "TRY_LOCK_SUCCESS", "Mutex", "Lkotlinx/coroutines/sync/Mutex;", "locked", "", "withLock", "T", "owner", "", "action", "Lkotlin/Function0;", "(Lkotlinx/coroutines/sync/Mutex;Ljava/lang/Object;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "kotlinx-coroutines-core"}, k = 2, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public final class MutexKt {
private static final int HOLDS_LOCK_ANOTHER_OWNER = 2;
private static final int HOLDS_LOCK_UNLOCKED = 0;
private static final int HOLDS_LOCK_YES = 1;
private static final Symbol NO_OWNER = new Symbol("NO_OWNER");
private static final Symbol ON_LOCK_ALREADY_LOCKED_BY_OWNER = new Symbol("ALREADY_LOCKED_BY_OWNER");
private static final int TRY_LOCK_ALREADY_LOCKED_BY_OWNER = 2;
private static final int TRY_LOCK_FAILED = 1;
private static final int TRY_LOCK_SUCCESS = 0;
public static final Mutex Mutex(boolean z3) {
return new MutexImpl(z3);
}
public static /* synthetic */ Mutex Mutex$default(boolean z3, int i, Object obj) {
if ((i & 1) != 0) {
z3 = false;
}
return Mutex(z3);
}
/* JADX WARN: Removed duplicated region for block: B:21:0x003c */
/* JADX WARN: Removed duplicated region for block: B:8:0x0023 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static final <T> java.lang.Object withLock(kotlinx.coroutines.sync.Mutex r4, java.lang.Object r5, kotlin.jvm.functions.Function0<? extends T> r6, kotlin.coroutines.Continuation<? super T> r7) {
/*
boolean r0 = r7 instanceof kotlinx.coroutines.sync.MutexKt$withLock$1
if (r0 == 0) goto L13
r0 = r7
kotlinx.coroutines.sync.MutexKt$withLock$1 r0 = (kotlinx.coroutines.sync.MutexKt$withLock$1) r0
int r1 = r0.label
r2 = -2147483648(0xffffffff80000000, float:-0.0)
r3 = r1 & r2
if (r3 == 0) goto L13
int r1 = r1 - r2
r0.label = r1
goto L18
L13:
kotlinx.coroutines.sync.MutexKt$withLock$1 r0 = new kotlinx.coroutines.sync.MutexKt$withLock$1
r0.<init>(r7)
L18:
java.lang.Object r7 = r0.result
java.lang.Object r1 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED()
int r2 = r0.label
r3 = 1
if (r2 == 0) goto L3c
if (r2 != r3) goto L34
java.lang.Object r4 = r0.L$2
r6 = r4
kotlin.jvm.functions.Function0 r6 = (kotlin.jvm.functions.Function0) r6
java.lang.Object r5 = r0.L$1
java.lang.Object r4 = r0.L$0
kotlinx.coroutines.sync.Mutex r4 = (kotlinx.coroutines.sync.Mutex) r4
kotlin.ResultKt.throwOnFailure(r7)
goto L4e
L34:
java.lang.IllegalStateException r4 = new java.lang.IllegalStateException
java.lang.String r5 = "call to 'resume' before 'invoke' with coroutine"
r4.<init>(r5)
throw r4
L3c:
kotlin.ResultKt.throwOnFailure(r7)
r0.L$0 = r4
r0.L$1 = r5
r0.L$2 = r6
r0.label = r3
java.lang.Object r7 = r4.lock(r5, r0)
if (r7 != r1) goto L4e
return r1
L4e:
java.lang.Object r6 = r6.invoke() // Catch: java.lang.Throwable -> L56
r4.unlock(r5)
return r6
L56:
r6 = move-exception
r4.unlock(r5)
throw r6
*/
throw new UnsupportedOperationException("Method not decompiled: kotlinx.coroutines.sync.MutexKt.withLock(kotlinx.coroutines.sync.Mutex, java.lang.Object, kotlin.jvm.functions.Function0, kotlin.coroutines.Continuation):java.lang.Object");
}
private static final <T> Object withLock$$forInline(Mutex mutex, Object obj, Function0<? extends T> function0, Continuation<? super T> continuation) {
InlineMarker.mark(0);
mutex.lock(obj, continuation);
InlineMarker.mark(1);
try {
return function0.invoke();
} finally {
mutex.unlock(obj);
}
}
public static /* synthetic */ Object withLock$default(Mutex mutex, Object obj, Function0 function0, Continuation continuation, int i, Object obj2) {
if ((i & 1) != 0) {
obj = null;
}
InlineMarker.mark(0);
mutex.lock(obj, continuation);
InlineMarker.mark(1);
try {
return function0.invoke();
} finally {
mutex.unlock(obj);
}
}
}

View File

@@ -0,0 +1,17 @@
package kotlinx.coroutines.sync;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
@Metadata(d1 = {"\u0000 \n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0000\bf\u0018\u00002\u00020\u0001J\u000e\u0010\u0006\u001a\u00020\u0007H¦@¢\u0006\u0002\u0010\bJ\b\u0010\t\u001a\u00020\u0007H&J\b\u0010\n\u001a\u00020\u000bH&R\u0012\u0010\u0002\u001a\u00020\u0003X¦\u0004¢\u0006\u0006\u001a\u0004\b\u0004\u0010\u0005¨\u0006\f"}, d2 = {"Lkotlinx/coroutines/sync/Semaphore;", "", "availablePermits", "", "getAvailablePermits", "()I", "acquire", "", "(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "release", "tryAcquire", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public interface Semaphore {
Object acquire(Continuation<? super Unit> continuation);
int getAvailablePermits();
void release();
boolean tryAcquire();
}

View File

@@ -0,0 +1,26 @@
package kotlinx.coroutines.sync;
import kotlin.Metadata;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.FunctionReferenceImpl;
@Metadata(k = 3, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public /* synthetic */ class SemaphoreImpl$addAcquireToQueue$createNewSegment$1 extends FunctionReferenceImpl implements Function2<Long, SemaphoreSegment, SemaphoreSegment> {
public static final SemaphoreImpl$addAcquireToQueue$createNewSegment$1 INSTANCE = new SemaphoreImpl$addAcquireToQueue$createNewSegment$1();
public SemaphoreImpl$addAcquireToQueue$createNewSegment$1() {
super(2, SemaphoreKt.class, "createSegment", "createSegment(JLkotlinx/coroutines/sync/SemaphoreSegment;)Lkotlinx/coroutines/sync/SemaphoreSegment;", 1);
}
@Override // kotlin.jvm.functions.Function2
public /* bridge */ /* synthetic */ SemaphoreSegment invoke(Long l4, SemaphoreSegment semaphoreSegment) {
return invoke(l4.longValue(), semaphoreSegment);
}
public final SemaphoreSegment invoke(long j4, SemaphoreSegment semaphoreSegment) {
SemaphoreSegment createSegment;
createSegment = SemaphoreKt.createSegment(j4, semaphoreSegment);
return createSegment;
}
}

View File

@@ -0,0 +1,26 @@
package kotlinx.coroutines.sync;
import kotlin.Metadata;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.FunctionReferenceImpl;
@Metadata(k = 3, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public /* synthetic */ class SemaphoreImpl$tryResumeNextFromQueue$createNewSegment$1 extends FunctionReferenceImpl implements Function2<Long, SemaphoreSegment, SemaphoreSegment> {
public static final SemaphoreImpl$tryResumeNextFromQueue$createNewSegment$1 INSTANCE = new SemaphoreImpl$tryResumeNextFromQueue$createNewSegment$1();
public SemaphoreImpl$tryResumeNextFromQueue$createNewSegment$1() {
super(2, SemaphoreKt.class, "createSegment", "createSegment(JLkotlinx/coroutines/sync/SemaphoreSegment;)Lkotlinx/coroutines/sync/SemaphoreSegment;", 1);
}
@Override // kotlin.jvm.functions.Function2
public /* bridge */ /* synthetic */ SemaphoreSegment invoke(Long l4, SemaphoreSegment semaphoreSegment) {
return invoke(l4.longValue(), semaphoreSegment);
}
public final SemaphoreSegment invoke(long j4, SemaphoreSegment semaphoreSegment) {
SemaphoreSegment createSegment;
createSegment = SemaphoreKt.createSegment(j4, semaphoreSegment);
return createSegment;
}
}

View File

@@ -0,0 +1,393 @@
package kotlinx.coroutines.sync;
import com.google.android.gms.measurement.api.AppMeasurementSdk;
import com.google.android.gms.measurement.internal.a;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
import java.util.concurrent.atomic.AtomicReferenceArray;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugProbesKt;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlinx.coroutines.CancellableContinuation;
import kotlinx.coroutines.CancellableContinuationImpl;
import kotlinx.coroutines.CancellableContinuationKt;
import kotlinx.coroutines.Waiter;
import kotlinx.coroutines.internal.ConcurrentLinkedListKt;
import kotlinx.coroutines.internal.Segment;
import kotlinx.coroutines.internal.SegmentOrClosed;
import kotlinx.coroutines.internal.Symbol;
import kotlinx.coroutines.selects.SelectInstance;
@Metadata(d1 = {"\u0000h\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0003\n\u0002\u0010\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0000\n\u0002\b\u0005\b\u0010\u0018\u00002\u00020\u0001B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0003¢\u0006\u0002\u0010\u0005J\u000e\u0010\u0016\u001a\u00020\u0014H\u0096@¢\u0006\u0002\u0010\u0017Jb\u0010\u0016\u001a\u00020\u0014\"\u0004\b\u0000\u0010\u00182\u0006\u0010\u0019\u001a\u0002H\u00182!\u0010\u001a\u001a\u001d\u0012\u0013\u0012\u0011H\u0018¢\u0006\f\b\u001b\u0012\b\b\u001c\u0012\u0004\b\b(\u0019\u0012\u0004\u0012\u00020\u001d0\u00122!\u0010\u001e\u001a\u001d\u0012\u0013\u0012\u0011H\u0018¢\u0006\f\b\u001b\u0012\b\b\u001c\u0012\u0004\b\b(\u0019\u0012\u0004\u0012\u00020\u00140\u0012H\u0083\\u0006\u0002\u0010\u001fJ\u0016\u0010\u0016\u001a\u00020\u00142\f\u0010\u0019\u001a\b\u0012\u0004\u0012\u00020\u00140 H\u0005J\u000e\u0010!\u001a\u00020\u0014H\u0082@¢\u0006\u0002\u0010\u0017J\u0010\u0010\"\u001a\u00020\u001d2\u0006\u0010\u0019\u001a\u00020#H\u0002J\b\u0010$\u001a\u00020\u0014H\u0002J\b\u0010%\u001a\u00020\u0003H\u0002J\u001e\u0010&\u001a\u00020\u00142\n\u0010'\u001a\u0006\u0012\u0002\b\u00030(2\b\u0010)\u001a\u0004\u0018\u00010*H\u0004J\b\u0010+\u001a\u00020\u0014H\u0016J\b\u0010,\u001a\u00020\u001dH\u0016J\b\u0010-\u001a\u00020\u001dH\u0002J\f\u0010.\u001a\u00020\u001d*\u00020*H\u0002R\t\u0010\u0006\u001a\u00020\u0007X\u0082\u0004R\u0014\u0010\b\u001a\u00020\u00038VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\t\u0010\nR\t\u0010\u000b\u001a\u00020\fX\u0082\u0004R\t\u0010\r\u001a\u00020\fX\u0082\u0004R\u000f\u0010\u000e\u001a\b\u0012\u0004\u0012\u00020\u00100\u000fX\u0082\u0004R\u001a\u0010\u0011\u001a\u000e\u0012\u0004\u0012\u00020\u0013\u0012\u0004\u0012\u00020\u00140\u0012X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u000f\u0010\u0015\u001a\b\u0012\u0004\u0012\u00020\u00100\u000fX\u0082\u0004¨\u0006/"}, d2 = {"Lkotlinx/coroutines/sync/SemaphoreImpl;", "Lkotlinx/coroutines/sync/Semaphore;", "permits", "", "acquiredPermits", "(II)V", "_availablePermits", "Lkotlinx/atomicfu/AtomicInt;", "availablePermits", "getAvailablePermits", "()I", "deqIdx", "Lkotlinx/atomicfu/AtomicLong;", "enqIdx", "head", "Lkotlinx/atomicfu/AtomicRef;", "Lkotlinx/coroutines/sync/SemaphoreSegment;", "onCancellationRelease", "Lkotlin/Function1;", "", "", "tail", "acquire", "(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "W", "waiter", "suspend", "Lkotlin/ParameterName;", AppMeasurementSdk.ConditionalUserProperty.NAME, "", "onAcquired", "(Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V", "Lkotlinx/coroutines/CancellableContinuation;", "acquireSlowPath", "addAcquireToQueue", "Lkotlinx/coroutines/Waiter;", "coerceAvailablePermitsAtMaximum", "decPermits", "onAcquireRegFunction", "select", "Lkotlinx/coroutines/selects/SelectInstance;", "ignoredParam", "", "release", "tryAcquire", "tryResumeNextFromQueue", "tryResumeAcquire", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nSemaphore.kt\nKotlin\n*S Kotlin\n*F\n+ 1 Semaphore.kt\nkotlinx/coroutines/sync/SemaphoreImpl\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 3 CancellableContinuation.kt\nkotlinx/coroutines/CancellableContinuationKt\n+ 4 ConcurrentLinkedList.kt\nkotlinx/coroutines/internal/ConcurrentLinkedListKt\n+ 5 Semaphore.kt\nkotlinx/coroutines/sync/SemaphoreSegment\n*L\n1#1,403:1\n211#1,10:417\n211#1,10:427\n1#2:404\n332#3,12:405\n72#4,3:437\n46#4,8:440\n72#4,3:451\n46#4,8:454\n381#5:448\n381#5:449\n373#5:450\n384#5:462\n373#5:463\n381#5:464\n*S KotlinDebug\n*F\n+ 1 Semaphore.kt\nkotlinx/coroutines/sync/SemaphoreImpl\n*L\n203#1:417,10\n227#1:427,10\n193#1:405,12\n295#1:437,3\n295#1:440,8\n328#1:451,3\n328#1:454,8\n299#1:448\n305#1:449\n319#1:450\n334#1:462\n340#1:463\n343#1:464\n*E\n"})
/* loaded from: classes3.dex */
public class SemaphoreImpl implements Semaphore {
private volatile /* synthetic */ int _availablePermits$volatile;
private volatile /* synthetic */ long deqIdx$volatile;
private volatile /* synthetic */ long enqIdx$volatile;
private volatile /* synthetic */ Object head$volatile;
private final Function1<Throwable, Unit> onCancellationRelease;
private final int permits;
private volatile /* synthetic */ Object tail$volatile;
private static final /* synthetic */ AtomicReferenceFieldUpdater head$volatile$FU = AtomicReferenceFieldUpdater.newUpdater(SemaphoreImpl.class, Object.class, "head$volatile");
private static final /* synthetic */ AtomicLongFieldUpdater deqIdx$volatile$FU = AtomicLongFieldUpdater.newUpdater(SemaphoreImpl.class, "deqIdx$volatile");
private static final /* synthetic */ AtomicReferenceFieldUpdater tail$volatile$FU = AtomicReferenceFieldUpdater.newUpdater(SemaphoreImpl.class, Object.class, "tail$volatile");
private static final /* synthetic */ AtomicLongFieldUpdater enqIdx$volatile$FU = AtomicLongFieldUpdater.newUpdater(SemaphoreImpl.class, "enqIdx$volatile");
private static final /* synthetic */ AtomicIntegerFieldUpdater _availablePermits$volatile$FU = AtomicIntegerFieldUpdater.newUpdater(SemaphoreImpl.class, "_availablePermits$volatile");
public SemaphoreImpl(int i, int i4) {
this.permits = i;
if (i <= 0) {
throw new IllegalArgumentException(a.l(i, "Semaphore should have at least 1 permit, but had ").toString());
}
if (i4 < 0 || i4 > i) {
throw new IllegalArgumentException(a.l(i, "The number of acquired permits should be in 0..").toString());
}
SemaphoreSegment semaphoreSegment = new SemaphoreSegment(0L, null, 2);
this.head$volatile = semaphoreSegment;
this.tail$volatile = semaphoreSegment;
this._availablePermits$volatile = i - i4;
this.onCancellationRelease = new Function1<Throwable, Unit>() { // from class: kotlinx.coroutines.sync.SemaphoreImpl$onCancellationRelease$1
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(Throwable th) {
invoke2(th);
return Unit.INSTANCE;
}
/* renamed from: invoke, reason: avoid collision after fix types in other method */
public final void invoke2(Throwable th) {
SemaphoreImpl.this.release();
}
};
}
public static /* synthetic */ Object acquire$suspendImpl(SemaphoreImpl semaphoreImpl, Continuation<? super Unit> continuation) {
Object acquireSlowPath;
return (semaphoreImpl.decPermits() <= 0 && (acquireSlowPath = semaphoreImpl.acquireSlowPath(continuation)) == IntrinsicsKt.getCOROUTINE_SUSPENDED()) ? acquireSlowPath : Unit.INSTANCE;
}
/* JADX INFO: Access modifiers changed from: private */
public final Object acquireSlowPath(Continuation<? super Unit> continuation) {
CancellableContinuationImpl orCreateCancellableContinuation = CancellableContinuationKt.getOrCreateCancellableContinuation(IntrinsicsKt.intercepted(continuation));
try {
if (!addAcquireToQueue(orCreateCancellableContinuation)) {
acquire((CancellableContinuation<? super Unit>) orCreateCancellableContinuation);
}
Object result = orCreateCancellableContinuation.getResult();
if (result == IntrinsicsKt.getCOROUTINE_SUSPENDED()) {
DebugProbesKt.probeCoroutineSuspended(continuation);
}
return result == IntrinsicsKt.getCOROUTINE_SUSPENDED() ? result : Unit.INSTANCE;
} catch (Throwable th) {
orCreateCancellableContinuation.releaseClaimedReusableContinuation$kotlinx_coroutines_core();
throw th;
}
}
/* JADX INFO: Access modifiers changed from: private */
public final boolean addAcquireToQueue(Waiter waiter) {
int i;
Object findSegmentInternal;
int i4;
Symbol symbol;
Symbol symbol2;
SemaphoreSegment semaphoreSegment = (SemaphoreSegment) tail$volatile$FU.get(this);
long andIncrement = enqIdx$volatile$FU.getAndIncrement(this);
SemaphoreImpl$addAcquireToQueue$createNewSegment$1 semaphoreImpl$addAcquireToQueue$createNewSegment$1 = SemaphoreImpl$addAcquireToQueue$createNewSegment$1.INSTANCE;
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = tail$volatile$FU;
i = SemaphoreKt.SEGMENT_SIZE;
long j4 = andIncrement / i;
loop0: while (true) {
findSegmentInternal = ConcurrentLinkedListKt.findSegmentInternal(semaphoreSegment, j4, semaphoreImpl$addAcquireToQueue$createNewSegment$1);
if (!SegmentOrClosed.m1693isClosedimpl(findSegmentInternal)) {
Segment m1691getSegmentimpl = SegmentOrClosed.m1691getSegmentimpl(findSegmentInternal);
while (true) {
Segment segment = (Segment) atomicReferenceFieldUpdater.get(this);
if (segment.id >= m1691getSegmentimpl.id) {
break loop0;
}
if (!m1691getSegmentimpl.tryIncPointers$kotlinx_coroutines_core()) {
break;
}
while (!atomicReferenceFieldUpdater.compareAndSet(this, segment, m1691getSegmentimpl)) {
if (atomicReferenceFieldUpdater.get(this) != segment) {
if (m1691getSegmentimpl.decPointers$kotlinx_coroutines_core()) {
m1691getSegmentimpl.remove();
}
}
}
if (segment.decPointers$kotlinx_coroutines_core()) {
segment.remove();
}
}
} else {
break;
}
}
SemaphoreSegment semaphoreSegment2 = (SemaphoreSegment) SegmentOrClosed.m1691getSegmentimpl(findSegmentInternal);
i4 = SemaphoreKt.SEGMENT_SIZE;
int i5 = (int) (andIncrement % i4);
AtomicReferenceArray acquirers = semaphoreSegment2.getAcquirers();
while (!acquirers.compareAndSet(i5, null, waiter)) {
if (acquirers.get(i5) != null) {
symbol = SemaphoreKt.PERMIT;
symbol2 = SemaphoreKt.TAKEN;
AtomicReferenceArray acquirers2 = semaphoreSegment2.getAcquirers();
while (!acquirers2.compareAndSet(i5, symbol, symbol2)) {
if (acquirers2.get(i5) != symbol) {
return false;
}
}
if (waiter instanceof CancellableContinuation) {
Intrinsics.checkNotNull(waiter, "null cannot be cast to non-null type kotlinx.coroutines.CancellableContinuation<kotlin.Unit>");
((CancellableContinuation) waiter).resume(Unit.INSTANCE, this.onCancellationRelease);
} else {
if (!(waiter instanceof SelectInstance)) {
throw new IllegalStateException(("unexpected: " + waiter).toString());
}
((SelectInstance) waiter).selectInRegistrationPhase(Unit.INSTANCE);
}
return true;
}
}
waiter.invokeOnCancellation(semaphoreSegment2, i5);
return true;
}
private final void coerceAvailablePermitsAtMaximum() {
int i;
do {
i = _availablePermits$volatile$FU.get(this);
if (i <= this.permits) {
return;
}
} while (!_availablePermits$volatile$FU.compareAndSet(this, i, this.permits));
}
private final int decPermits() {
int andDecrement;
do {
andDecrement = _availablePermits$volatile$FU.getAndDecrement(this);
} while (andDecrement > this.permits);
return andDecrement;
}
private final /* synthetic */ long getDeqIdx$volatile() {
return this.deqIdx$volatile;
}
private final /* synthetic */ long getEnqIdx$volatile() {
return this.enqIdx$volatile;
}
private final /* synthetic */ Object getHead$volatile() {
return this.head$volatile;
}
private final /* synthetic */ Object getTail$volatile() {
return this.tail$volatile;
}
private final /* synthetic */ int get_availablePermits$volatile() {
return this._availablePermits$volatile;
}
private final /* synthetic */ void setDeqIdx$volatile(long j4) {
this.deqIdx$volatile = j4;
}
private final /* synthetic */ void setEnqIdx$volatile(long j4) {
this.enqIdx$volatile = j4;
}
private final /* synthetic */ void setHead$volatile(Object obj) {
this.head$volatile = obj;
}
private final /* synthetic */ void setTail$volatile(Object obj) {
this.tail$volatile = obj;
}
private final /* synthetic */ void set_availablePermits$volatile(int i) {
this._availablePermits$volatile = i;
}
private final boolean tryResumeAcquire(Object obj) {
if (!(obj instanceof CancellableContinuation)) {
if (obj instanceof SelectInstance) {
return ((SelectInstance) obj).trySelect(this, Unit.INSTANCE);
}
throw new IllegalStateException(("unexpected: " + obj).toString());
}
Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type kotlinx.coroutines.CancellableContinuation<kotlin.Unit>");
CancellableContinuation cancellableContinuation = (CancellableContinuation) obj;
Object tryResume = cancellableContinuation.tryResume(Unit.INSTANCE, null, this.onCancellationRelease);
if (tryResume == null) {
return false;
}
cancellableContinuation.completeResume(tryResume);
return true;
}
private final boolean tryResumeNextFromQueue() {
int i;
Object findSegmentInternal;
int i4;
Symbol symbol;
Symbol symbol2;
int i5;
Symbol symbol3;
Symbol symbol4;
Symbol symbol5;
SemaphoreSegment semaphoreSegment = (SemaphoreSegment) head$volatile$FU.get(this);
long andIncrement = deqIdx$volatile$FU.getAndIncrement(this);
i = SemaphoreKt.SEGMENT_SIZE;
long j4 = andIncrement / i;
SemaphoreImpl$tryResumeNextFromQueue$createNewSegment$1 semaphoreImpl$tryResumeNextFromQueue$createNewSegment$1 = SemaphoreImpl$tryResumeNextFromQueue$createNewSegment$1.INSTANCE;
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = head$volatile$FU;
loop0: while (true) {
findSegmentInternal = ConcurrentLinkedListKt.findSegmentInternal(semaphoreSegment, j4, semaphoreImpl$tryResumeNextFromQueue$createNewSegment$1);
if (SegmentOrClosed.m1693isClosedimpl(findSegmentInternal)) {
break;
}
Segment m1691getSegmentimpl = SegmentOrClosed.m1691getSegmentimpl(findSegmentInternal);
while (true) {
Segment segment = (Segment) atomicReferenceFieldUpdater.get(this);
if (segment.id >= m1691getSegmentimpl.id) {
break loop0;
}
if (!m1691getSegmentimpl.tryIncPointers$kotlinx_coroutines_core()) {
break;
}
while (!atomicReferenceFieldUpdater.compareAndSet(this, segment, m1691getSegmentimpl)) {
if (atomicReferenceFieldUpdater.get(this) != segment) {
if (m1691getSegmentimpl.decPointers$kotlinx_coroutines_core()) {
m1691getSegmentimpl.remove();
}
}
}
if (segment.decPointers$kotlinx_coroutines_core()) {
segment.remove();
}
}
}
SemaphoreSegment semaphoreSegment2 = (SemaphoreSegment) SegmentOrClosed.m1691getSegmentimpl(findSegmentInternal);
semaphoreSegment2.cleanPrev();
boolean z3 = false;
if (semaphoreSegment2.id > j4) {
return false;
}
i4 = SemaphoreKt.SEGMENT_SIZE;
int i6 = (int) (andIncrement % i4);
symbol = SemaphoreKt.PERMIT;
Object andSet = semaphoreSegment2.getAcquirers().getAndSet(i6, symbol);
if (andSet != null) {
symbol2 = SemaphoreKt.CANCELLED;
if (andSet == symbol2) {
return false;
}
return tryResumeAcquire(andSet);
}
i5 = SemaphoreKt.MAX_SPIN_CYCLES;
for (int i7 = 0; i7 < i5; i7++) {
Object obj = semaphoreSegment2.getAcquirers().get(i6);
symbol5 = SemaphoreKt.TAKEN;
if (obj == symbol5) {
return true;
}
}
symbol3 = SemaphoreKt.PERMIT;
symbol4 = SemaphoreKt.BROKEN;
AtomicReferenceArray acquirers = semaphoreSegment2.getAcquirers();
while (true) {
if (acquirers.compareAndSet(i6, symbol3, symbol4)) {
z3 = true;
break;
}
if (acquirers.get(i6) != symbol3) {
break;
}
}
return !z3;
}
@Override // kotlinx.coroutines.sync.Semaphore
public Object acquire(Continuation<? super Unit> continuation) {
return acquire$suspendImpl(this, continuation);
}
@Override // kotlinx.coroutines.sync.Semaphore
public int getAvailablePermits() {
return Math.max(_availablePermits$volatile$FU.get(this), 0);
}
public final void onAcquireRegFunction(SelectInstance<?> select, Object ignoredParam) {
while (decPermits() <= 0) {
Intrinsics.checkNotNull(select, "null cannot be cast to non-null type kotlinx.coroutines.Waiter");
if (addAcquireToQueue((Waiter) select)) {
return;
}
}
select.selectInRegistrationPhase(Unit.INSTANCE);
}
@Override // kotlinx.coroutines.sync.Semaphore
public void release() {
do {
int andIncrement = _availablePermits$volatile$FU.getAndIncrement(this);
if (andIncrement >= this.permits) {
coerceAvailablePermitsAtMaximum();
throw new IllegalStateException(("The number of released permits cannot be greater than " + this.permits).toString());
}
if (andIncrement >= 0) {
return;
}
} while (!tryResumeNextFromQueue());
}
@Override // kotlinx.coroutines.sync.Semaphore
public boolean tryAcquire() {
while (true) {
int i = _availablePermits$volatile$FU.get(this);
if (i > this.permits) {
coerceAvailablePermitsAtMaximum();
} else {
if (i <= 0) {
return false;
}
if (_availablePermits$volatile$FU.compareAndSet(this, i, i - 1)) {
return true;
}
}
}
}
private final <W> void acquire(W waiter, Function1<? super W, Boolean> suspend, Function1<? super W, Unit> onAcquired) {
while (decPermits() <= 0) {
if (suspend.invoke(waiter).booleanValue()) {
return;
}
}
onAcquired.invoke(waiter);
}
public final void acquire(CancellableContinuation<? super Unit> waiter) {
while (decPermits() <= 0) {
Intrinsics.checkNotNull(waiter, "null cannot be cast to non-null type kotlinx.coroutines.Waiter");
if (addAcquireToQueue((Waiter) waiter)) {
return;
}
}
waiter.resume(Unit.INSTANCE, this.onCancellationRelease);
}
}

View File

@@ -0,0 +1,30 @@
package kotlinx.coroutines.sync;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.ContinuationImpl;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.jvm.internal.IntCompanionObject;
import kotlin.jvm.internal.SourceDebugExtension;
@Metadata(k = 3, mv = {1, 9, 0}, xi = 176)
@DebugMetadata(c = "kotlinx.coroutines.sync.SemaphoreKt", f = "Semaphore.kt", i = {0, 0}, l = {89}, m = "withPermit", n = {"$this$withPermit", "action"}, s = {"L$0", "L$1"})
@SourceDebugExtension({"SMAP\nSemaphore.kt\nKotlin\n*S Kotlin\n*F\n+ 1 Semaphore.kt\nkotlinx/coroutines/sync/SemaphoreKt$withPermit$1\n*L\n1#1,403:1\n*E\n"})
/* loaded from: classes3.dex */
public final class SemaphoreKt$withPermit$1<T> extends ContinuationImpl {
Object L$0;
Object L$1;
int label;
/* synthetic */ Object result;
public SemaphoreKt$withPermit$1(Continuation<? super SemaphoreKt$withPermit$1> continuation) {
super(continuation);
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
this.result = obj;
this.label |= IntCompanionObject.MIN_VALUE;
return SemaphoreKt.withPermit(null, null, this);
}
}

View File

@@ -0,0 +1,121 @@
package kotlinx.coroutines.sync;
import com.adif.elcanomovil.commonNavGraph.arguments.NavArguments;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.InlineMarker;
import kotlinx.coroutines.internal.Symbol;
import kotlinx.coroutines.internal.SystemPropsKt__SystemProps_commonKt;
@Metadata(d1 = {"\u00000\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\u001a\u0018\u0010\b\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\u00042\b\b\u0002\u0010\u000b\u001a\u00020\u0004\u001a\u001a\u0010\f\u001a\u00020\r2\u0006\u0010\u000e\u001a\u00020\u000f2\b\u0010\u0010\u001a\u0004\u0018\u00010\rH\u0002\u001a3\u0010\u0011\u001a\u0002H\u0012\"\u0004\b\u0000\u0010\u0012*\u00020\t2\f\u0010\u0013\u001a\b\u0012\u0004\u0012\u0002H\u00120\u0014H\u0086H\u0082\u0002\n\n\b\b\u0001\u0012\u0002\u0010\u0001 \u0001¢\u0006\u0002\u0010\u0015\"\u000e\u0010\u0000\u001a\u00020\u0001X\u0082\u0004¢\u0006\u0002\n\u0000\"\u000e\u0010\u0002\u001a\u00020\u0001X\u0082\u0004¢\u0006\u0002\n\u0000\"\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u0004¢\u0006\u0002\n\u0000\"\u000e\u0010\u0005\u001a\u00020\u0001X\u0082\u0004¢\u0006\u0002\n\u0000\"\u000e\u0010\u0006\u001a\u00020\u0004X\u0082\u0004¢\u0006\u0002\n\u0000\"\u000e\u0010\u0007\u001a\u00020\u0001X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0016"}, d2 = {"BROKEN", "Lkotlinx/coroutines/internal/Symbol;", "CANCELLED", "MAX_SPIN_CYCLES", "", "PERMIT", "SEGMENT_SIZE", "TAKEN", "Semaphore", "Lkotlinx/coroutines/sync/Semaphore;", "permits", "acquiredPermits", "createSegment", "Lkotlinx/coroutines/sync/SemaphoreSegment;", NavArguments.ARG_TYPE_NOTIFICATION_JSON_MESSAGE_TRAIN, "", "prev", "withPermit", "T", "action", "Lkotlin/Function0;", "(Lkotlinx/coroutines/sync/Semaphore;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "kotlinx-coroutines-core"}, k = 2, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public final class SemaphoreKt {
private static final Symbol BROKEN;
private static final Symbol CANCELLED;
private static final int MAX_SPIN_CYCLES;
private static final Symbol PERMIT;
private static final int SEGMENT_SIZE;
private static final Symbol TAKEN;
static {
int systemProp$default;
int systemProp$default2;
systemProp$default = SystemPropsKt__SystemProps_commonKt.systemProp$default("kotlinx.coroutines.semaphore.maxSpinCycles", 100, 0, 0, 12, (Object) null);
MAX_SPIN_CYCLES = systemProp$default;
PERMIT = new Symbol("PERMIT");
TAKEN = new Symbol("TAKEN");
BROKEN = new Symbol("BROKEN");
CANCELLED = new Symbol("CANCELLED");
systemProp$default2 = SystemPropsKt__SystemProps_commonKt.systemProp$default("kotlinx.coroutines.semaphore.segmentSize", 16, 0, 0, 12, (Object) null);
SEGMENT_SIZE = systemProp$default2;
}
public static final Semaphore Semaphore(int i, int i4) {
return new SemaphoreImpl(i, i4);
}
public static /* synthetic */ Semaphore Semaphore$default(int i, int i4, int i5, Object obj) {
if ((i5 & 2) != 0) {
i4 = 0;
}
return Semaphore(i, i4);
}
/* JADX INFO: Access modifiers changed from: private */
public static final SemaphoreSegment createSegment(long j4, SemaphoreSegment semaphoreSegment) {
return new SemaphoreSegment(j4, semaphoreSegment, 0);
}
/* JADX WARN: Removed duplicated region for block: B:21:0x003a */
/* JADX WARN: Removed duplicated region for block: B:8:0x0023 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static final <T> java.lang.Object withPermit(kotlinx.coroutines.sync.Semaphore r4, kotlin.jvm.functions.Function0<? extends T> r5, kotlin.coroutines.Continuation<? super T> r6) {
/*
boolean r0 = r6 instanceof kotlinx.coroutines.sync.SemaphoreKt$withPermit$1
if (r0 == 0) goto L13
r0 = r6
kotlinx.coroutines.sync.SemaphoreKt$withPermit$1 r0 = (kotlinx.coroutines.sync.SemaphoreKt$withPermit$1) r0
int r1 = r0.label
r2 = -2147483648(0xffffffff80000000, float:-0.0)
r3 = r1 & r2
if (r3 == 0) goto L13
int r1 = r1 - r2
r0.label = r1
goto L18
L13:
kotlinx.coroutines.sync.SemaphoreKt$withPermit$1 r0 = new kotlinx.coroutines.sync.SemaphoreKt$withPermit$1
r0.<init>(r6)
L18:
java.lang.Object r6 = r0.result
java.lang.Object r1 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED()
int r2 = r0.label
r3 = 1
if (r2 == 0) goto L3a
if (r2 != r3) goto L32
java.lang.Object r4 = r0.L$1
r5 = r4
kotlin.jvm.functions.Function0 r5 = (kotlin.jvm.functions.Function0) r5
java.lang.Object r4 = r0.L$0
kotlinx.coroutines.sync.Semaphore r4 = (kotlinx.coroutines.sync.Semaphore) r4
kotlin.ResultKt.throwOnFailure(r6)
goto L4a
L32:
java.lang.IllegalStateException r4 = new java.lang.IllegalStateException
java.lang.String r5 = "call to 'resume' before 'invoke' with coroutine"
r4.<init>(r5)
throw r4
L3a:
kotlin.ResultKt.throwOnFailure(r6)
r0.L$0 = r4
r0.L$1 = r5
r0.label = r3
java.lang.Object r6 = r4.acquire(r0)
if (r6 != r1) goto L4a
return r1
L4a:
java.lang.Object r5 = r5.invoke() // Catch: java.lang.Throwable -> L52
r4.release()
return r5
L52:
r5 = move-exception
r4.release()
throw r5
*/
throw new UnsupportedOperationException("Method not decompiled: kotlinx.coroutines.sync.SemaphoreKt.withPermit(kotlinx.coroutines.sync.Semaphore, kotlin.jvm.functions.Function0, kotlin.coroutines.Continuation):java.lang.Object");
}
private static final <T> Object withPermit$$forInline(Semaphore semaphore, Function0<? extends T> function0, Continuation<? super T> continuation) {
InlineMarker.mark(0);
semaphore.acquire(continuation);
InlineMarker.mark(1);
try {
return function0.invoke();
} finally {
semaphore.release();
}
}
}

View File

@@ -0,0 +1,70 @@
package kotlinx.coroutines.sync;
import com.adif.elcanomovil.commonNavGraph.arguments.NavArguments;
import com.google.firebase.analytics.FirebaseAnalytics;
import java.util.concurrent.atomic.AtomicReferenceArray;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlinx.coroutines.internal.Segment;
import kotlinx.coroutines.internal.Symbol;
/* JADX INFO: Access modifiers changed from: package-private */
@Metadata(d1 = {"\u0000H\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0002\b\u0006\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u0003\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\b\u0002\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\u001f\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\b\u0010\u0004\u001a\u0004\u0018\u00010\u0000\u0012\u0006\u0010\u0005\u001a\u00020\u0006¢\u0006\u0002\u0010\u0007J%\u0010\u000e\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u00062\b\u0010\u0011\u001a\u0004\u0018\u00010\n2\b\u0010\u0012\u001a\u0004\u0018\u00010\nH\u0086\bJ\u0013\u0010\u0013\u001a\u0004\u0018\u00010\n2\u0006\u0010\u0010\u001a\u00020\u0006H\u0086\bJ\u001d\u0010\u0014\u001a\u0004\u0018\u00010\n2\u0006\u0010\u0010\u001a\u00020\u00062\b\u0010\u0012\u001a\u0004\u0018\u00010\nH\u0086\bJ\"\u0010\u0015\u001a\u00020\u00162\u0006\u0010\u0010\u001a\u00020\u00062\b\u0010\u0017\u001a\u0004\u0018\u00010\u00182\u0006\u0010\u0019\u001a\u00020\u001aH\u0016J\u001b\u0010\u001b\u001a\u00020\u00162\u0006\u0010\u0010\u001a\u00020\u00062\b\u0010\u0012\u001a\u0004\u0018\u00010\nH\u0086\bJ\b\u0010\u001c\u001a\u00020\u001dH\u0016R\u000e\u0010\b\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\n0\tR\u0014\u0010\u000b\u001a\u00020\u00068VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\f\u0010\\u0006\u001e"}, d2 = {"Lkotlinx/coroutines/sync/SemaphoreSegment;", "Lkotlinx/coroutines/internal/Segment;", NavArguments.ARG_TYPE_NOTIFICATION_JSON_MESSAGE_TRAIN, "", "prev", "pointers", "", "(JLkotlinx/coroutines/sync/SemaphoreSegment;I)V", "acquirers", "Lkotlinx/atomicfu/AtomicArray;", "", "numberOfSlots", "getNumberOfSlots", "()I", "cas", "", FirebaseAnalytics.Param.INDEX, "expected", "value", "get", "getAndSet", "onCancellation", "", "cause", "", "context", "Lkotlin/coroutines/CoroutineContext;", "set", "toString", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nSemaphore.kt\nKotlin\n*S Kotlin\n*F\n+ 1 Semaphore.kt\nkotlinx/coroutines/sync/SemaphoreSegment\n*L\n1#1,403:1\n377#1,2:404\n*S KotlinDebug\n*F\n+ 1 Semaphore.kt\nkotlinx/coroutines/sync/SemaphoreSegment\n*L\n390#1:404,2\n*E\n"})
/* loaded from: classes3.dex */
public final class SemaphoreSegment extends Segment<SemaphoreSegment> {
private final /* synthetic */ AtomicReferenceArray acquirers;
public SemaphoreSegment(long j4, SemaphoreSegment semaphoreSegment, int i) {
super(j4, semaphoreSegment, i);
int i4;
i4 = SemaphoreKt.SEGMENT_SIZE;
this.acquirers = new AtomicReferenceArray(i4);
}
public final boolean cas(int index, Object expected, Object value) {
AtomicReferenceArray acquirers = getAcquirers();
while (!acquirers.compareAndSet(index, expected, value)) {
if (acquirers.get(index) != expected) {
return false;
}
}
return true;
}
public final Object get(int index) {
return getAcquirers().get(index);
}
public final /* synthetic */ AtomicReferenceArray getAcquirers() {
return this.acquirers;
}
public final Object getAndSet(int index, Object value) {
return getAcquirers().getAndSet(index, value);
}
@Override // kotlinx.coroutines.internal.Segment
public int getNumberOfSlots() {
int i;
i = SemaphoreKt.SEGMENT_SIZE;
return i;
}
@Override // kotlinx.coroutines.internal.Segment
public void onCancellation(int index, Throwable cause, CoroutineContext context) {
Symbol symbol;
symbol = SemaphoreKt.CANCELLED;
getAcquirers().set(index, symbol);
onSlotCleaned();
}
public final void set(int index, Object value) {
getAcquirers().set(index, value);
}
public String toString() {
return "SemaphoreSegment[id=" + this.id + ", hashCode=" + hashCode() + ']';
}
}