Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
package kotlinx.coroutines.sync;
import kotlin.coroutines.Continuation;
/* loaded from: classes5.dex */
public interface Mutex {
boolean isLocked();
Object lock(Object obj, Continuation continuation);
void unlock(Object obj);
public static final class DefaultImpls {
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);
}
}
}

View File

@@ -0,0 +1,284 @@
package kotlinx.coroutines.sync;
import androidx.concurrent.futures.AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0;
import com.amazonaws.handlers.HandlerChainFactory$$ExternalSyntheticThrowCCEIfNotNull0;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugProbesKt;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function3;
import kotlinx.coroutines.CancellableContinuation;
import kotlinx.coroutines.CancellableContinuationImpl;
import kotlinx.coroutines.CancellableContinuationKt;
import kotlinx.coroutines.CoroutineDispatcher;
import kotlinx.coroutines.DebugStringsKt;
import kotlinx.coroutines.Waiter;
import kotlinx.coroutines.internal.Segment;
import kotlinx.coroutines.internal.Symbol;
import kotlinx.coroutines.selects.SelectInstance;
/* loaded from: classes5.dex */
public class MutexImpl extends SemaphoreImpl implements Mutex {
public static final AtomicReferenceFieldUpdater owner$FU = AtomicReferenceFieldUpdater.newUpdater(MutexImpl.class, Object.class, "owner");
public final Function3 onSelectCancellationUnlockConstructor;
private volatile Object owner;
@Override // kotlinx.coroutines.sync.Mutex
public Object lock(Object obj, Continuation continuation) {
return lock$suspendImpl(this, obj, continuation);
}
public MutexImpl(boolean z) {
super(1, z ? 1 : 0);
this.owner = z ? null : MutexKt.NO_OWNER;
this.onSelectCancellationUnlockConstructor = new Function3() { // from class: kotlinx.coroutines.sync.MutexImpl$onSelectCancellationUnlockConstructor$1
{
super(3);
}
@Override // kotlin.jvm.functions.Function3
public /* bridge */ /* synthetic */ Object invoke(Object obj, Object obj2, Object obj3) {
HandlerChainFactory$$ExternalSyntheticThrowCCEIfNotNull0.m(obj);
return invoke((SelectInstance) null, obj2, obj3);
}
public final Function1 invoke(SelectInstance selectInstance, final Object obj, Object obj2) {
final MutexImpl mutexImpl = MutexImpl.this;
return new Function1() { // 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 */ Object invoke(Object obj3) {
invoke((Throwable) obj3);
return Unit.INSTANCE;
}
public final void invoke(Throwable th) {
MutexImpl.this.unlock(obj);
}
};
}
};
}
@Override // kotlinx.coroutines.sync.Mutex
public boolean isLocked() {
return getAvailablePermits() == 0;
}
public final int holdsLockImpl(Object obj) {
Symbol symbol;
while (isLocked()) {
Object obj2 = owner$FU.get(this);
symbol = MutexKt.NO_OWNER;
if (obj2 != symbol) {
return obj2 == obj ? 1 : 2;
}
}
return 0;
}
public static /* synthetic */ Object lock$suspendImpl(MutexImpl mutexImpl, Object obj, Continuation continuation) {
Object coroutine_suspended;
if (mutexImpl.tryLock(obj)) {
return Unit.INSTANCE;
}
Object lockSuspend = mutexImpl.lockSuspend(obj, continuation);
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
return lockSuspend == coroutine_suspended ? lockSuspend : Unit.INSTANCE;
}
public boolean tryLock(Object obj) {
int tryLockImpl = tryLockImpl(obj);
if (tryLockImpl == 0) {
return true;
}
if (tryLockImpl == 1) {
return false;
}
if (tryLockImpl == 2) {
throw new IllegalStateException(("This mutex is already locked by the specified owner: " + obj).toString());
}
throw new IllegalStateException("unexpected".toString());
}
public final int tryLockImpl(Object obj) {
while (!tryAcquire()) {
if (obj == null) {
return 1;
}
int holdsLockImpl = holdsLockImpl(obj);
if (holdsLockImpl == 1) {
return 2;
}
if (holdsLockImpl == 2) {
return 1;
}
}
owner$FU.set(this, obj);
return 0;
}
@Override // kotlinx.coroutines.sync.Mutex
public void unlock(Object obj) {
Symbol symbol;
Symbol symbol2;
while (isLocked()) {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = owner$FU;
Object obj2 = atomicReferenceFieldUpdater.get(this);
symbol = MutexKt.NO_OWNER;
if (obj2 != symbol) {
if (obj2 != obj && obj != null) {
throw new IllegalStateException(("This mutex is locked by " + obj2 + ", but " + obj + " is expected").toString());
}
symbol2 = MutexKt.NO_OWNER;
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(atomicReferenceFieldUpdater, this, obj2, symbol2)) {
release();
return;
}
}
}
throw new IllegalStateException("This mutex is not locked".toString());
}
public final class CancellableContinuationWithOwner implements CancellableContinuation, Waiter {
public final CancellableContinuationImpl cont;
public final Object owner;
@Override // kotlinx.coroutines.CancellableContinuation
public boolean cancel(Throwable th) {
return this.cont.cancel(th);
}
@Override // kotlinx.coroutines.CancellableContinuation
public void completeResume(Object obj) {
this.cont.completeResume(obj);
}
@Override // kotlin.coroutines.Continuation
public CoroutineContext getContext() {
return this.cont.getContext();
}
@Override // kotlinx.coroutines.CancellableContinuation
public void invokeOnCancellation(Function1 function1) {
this.cont.invokeOnCancellation(function1);
}
@Override // kotlinx.coroutines.Waiter
public void invokeOnCancellation(Segment segment, int i) {
this.cont.invokeOnCancellation(segment, i);
}
@Override // kotlinx.coroutines.CancellableContinuation
public boolean isActive() {
return this.cont.isActive();
}
@Override // kotlinx.coroutines.CancellableContinuation
public boolean isCompleted() {
return this.cont.isCompleted();
}
@Override // kotlinx.coroutines.CancellableContinuation
public void resumeUndispatched(CoroutineDispatcher coroutineDispatcher, Unit unit) {
this.cont.resumeUndispatched(coroutineDispatcher, unit);
}
@Override // kotlin.coroutines.Continuation
public void resumeWith(Object obj) {
this.cont.resumeWith(obj);
}
@Override // kotlinx.coroutines.CancellableContinuation
public Object tryResumeWithException(Throwable th) {
return this.cont.tryResumeWithException(th);
}
public CancellableContinuationWithOwner(CancellableContinuationImpl cancellableContinuationImpl, Object obj) {
this.cont = cancellableContinuationImpl;
this.owner = obj;
}
@Override // kotlinx.coroutines.CancellableContinuation
public Object tryResume(Unit unit, Object obj, Function1 function1) {
final MutexImpl mutexImpl = MutexImpl.this;
Object tryResume = this.cont.tryResume(unit, obj, new Function1() { // 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 */ Object invoke(Object obj2) {
invoke((Throwable) obj2);
return Unit.INSTANCE;
}
public final void invoke(Throwable th) {
MutexImpl.owner$FU.set(MutexImpl.this, this.owner);
MutexImpl.this.unlock(this.owner);
}
});
if (tryResume != null) {
MutexImpl.owner$FU.set(MutexImpl.this, this.owner);
}
return tryResume;
}
@Override // kotlinx.coroutines.CancellableContinuation
public void resume(Unit unit, Function1 function1) {
MutexImpl.owner$FU.set(MutexImpl.this, this.owner);
CancellableContinuationImpl cancellableContinuationImpl = this.cont;
final MutexImpl mutexImpl = MutexImpl.this;
cancellableContinuationImpl.resume(unit, new Function1() { // 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 */ Object invoke(Object obj) {
invoke((Throwable) obj);
return Unit.INSTANCE;
}
public final void invoke(Throwable th) {
MutexImpl.this.unlock(this.owner);
}
});
}
}
public String toString() {
return "Mutex@" + DebugStringsKt.getHexAddress(this) + "[isLocked=" + isLocked() + ",owner=" + owner$FU.get(this) + ']';
}
public final Object lockSuspend(Object obj, Continuation continuation) {
Continuation intercepted;
Object coroutine_suspended;
Object coroutine_suspended2;
intercepted = IntrinsicsKt__IntrinsicsJvmKt.intercepted(continuation);
CancellableContinuationImpl orCreateCancellableContinuation = CancellableContinuationKt.getOrCreateCancellableContinuation(intercepted);
try {
acquire(new CancellableContinuationWithOwner(orCreateCancellableContinuation, obj));
Object result = orCreateCancellableContinuation.getResult();
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
if (result == coroutine_suspended) {
DebugProbesKt.probeCoroutineSuspended(continuation);
}
coroutine_suspended2 = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
return result == coroutine_suspended2 ? result : Unit.INSTANCE;
} catch (Throwable th) {
orCreateCancellableContinuation.releaseClaimedReusableContinuation$kotlinx_coroutines_core();
throw th;
}
}
}

View File

@@ -0,0 +1,20 @@
package kotlinx.coroutines.sync;
import kotlinx.coroutines.internal.Symbol;
/* loaded from: classes5.dex */
public abstract class MutexKt {
public static final Symbol NO_OWNER = new Symbol("NO_OWNER");
public static final Symbol ON_LOCK_ALREADY_LOCKED_BY_OWNER = new Symbol("ALREADY_LOCKED_BY_OWNER");
public static /* synthetic */ Mutex Mutex$default(boolean z, int i, Object obj) {
if ((i & 1) != 0) {
z = false;
}
return Mutex(z);
}
public static final Mutex Mutex(boolean z) {
return new MutexImpl(z);
}
}

View File

@@ -0,0 +1,24 @@
package kotlinx.coroutines.sync;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.FunctionReferenceImpl;
/* loaded from: classes5.dex */
public /* synthetic */ class SemaphoreImpl$addAcquireToQueue$createNewSegment$1 extends FunctionReferenceImpl implements Function2 {
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 */ Object invoke(Object obj, Object obj2) {
return invoke(((Number) obj).longValue(), (SemaphoreSegment) obj2);
}
public final SemaphoreSegment invoke(long j, SemaphoreSegment semaphoreSegment) {
SemaphoreSegment createSegment;
createSegment = SemaphoreKt.createSegment(j, semaphoreSegment);
return createSegment;
}
}

View File

@@ -0,0 +1,24 @@
package kotlinx.coroutines.sync;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.FunctionReferenceImpl;
/* loaded from: classes5.dex */
public /* synthetic */ class SemaphoreImpl$tryResumeNextFromQueue$createNewSegment$1 extends FunctionReferenceImpl implements Function2 {
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 */ Object invoke(Object obj, Object obj2) {
return invoke(((Number) obj).longValue(), (SemaphoreSegment) obj2);
}
public final SemaphoreSegment invoke(long j, SemaphoreSegment semaphoreSegment) {
SemaphoreSegment createSegment;
createSegment = SemaphoreKt.createSegment(j, semaphoreSegment);
return createSegment;
}
}

View File

@@ -0,0 +1,266 @@
package kotlinx.coroutines.sync;
import androidx.concurrent.futures.AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0;
import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.CancellableContinuation;
import kotlinx.coroutines.Waiter;
import kotlinx.coroutines.channels.ChannelSegment$$ExternalSyntheticBackportWithForwarding0;
import kotlinx.coroutines.internal.ConcurrentLinkedListKt;
import kotlinx.coroutines.internal.Segment;
import kotlinx.coroutines.internal.SegmentOrClosed;
import kotlinx.coroutines.internal.Symbol;
/* loaded from: classes5.dex */
public class SemaphoreImpl {
private volatile int _availablePermits;
private volatile long deqIdx;
private volatile long enqIdx;
private volatile Object head;
public final Function1 onCancellationRelease;
public final int permits;
private volatile Object tail;
public static final AtomicReferenceFieldUpdater head$FU = AtomicReferenceFieldUpdater.newUpdater(SemaphoreImpl.class, Object.class, TtmlNode.TAG_HEAD);
public static final AtomicLongFieldUpdater deqIdx$FU = AtomicLongFieldUpdater.newUpdater(SemaphoreImpl.class, "deqIdx");
public static final AtomicReferenceFieldUpdater tail$FU = AtomicReferenceFieldUpdater.newUpdater(SemaphoreImpl.class, Object.class, "tail");
public static final AtomicLongFieldUpdater enqIdx$FU = AtomicLongFieldUpdater.newUpdater(SemaphoreImpl.class, "enqIdx");
public static final AtomicIntegerFieldUpdater _availablePermits$FU = AtomicIntegerFieldUpdater.newUpdater(SemaphoreImpl.class, "_availablePermits");
public SemaphoreImpl(int i, int i2) {
this.permits = i;
if (i <= 0) {
throw new IllegalArgumentException(("Semaphore should have at least 1 permit, but had " + i).toString());
}
if (i2 < 0 || i2 > i) {
throw new IllegalArgumentException(("The number of acquired permits should be in 0.." + i).toString());
}
SemaphoreSegment semaphoreSegment = new SemaphoreSegment(0L, null, 2);
this.head = semaphoreSegment;
this.tail = semaphoreSegment;
this._availablePermits = i - i2;
this.onCancellationRelease = new Function1() { // from class: kotlinx.coroutines.sync.SemaphoreImpl$onCancellationRelease$1
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Object invoke(Object obj) {
invoke((Throwable) obj);
return Unit.INSTANCE;
}
public final void invoke(Throwable th) {
SemaphoreImpl.this.release();
}
};
}
public int getAvailablePermits() {
return Math.max(_availablePermits$FU.get(this), 0);
}
public boolean tryAcquire() {
while (true) {
AtomicIntegerFieldUpdater atomicIntegerFieldUpdater = _availablePermits$FU;
int i = atomicIntegerFieldUpdater.get(this);
if (i > this.permits) {
coerceAvailablePermitsAtMaximum();
} else {
if (i <= 0) {
return false;
}
if (atomicIntegerFieldUpdater.compareAndSet(this, i, i - 1)) {
return true;
}
}
}
}
public final void acquire(CancellableContinuation cancellableContinuation) {
while (decPermits() <= 0) {
Intrinsics.checkNotNull(cancellableContinuation, "null cannot be cast to non-null type kotlinx.coroutines.Waiter");
if (addAcquireToQueue((Waiter) cancellableContinuation)) {
return;
}
}
cancellableContinuation.resume(Unit.INSTANCE, this.onCancellationRelease);
}
public final int decPermits() {
int andDecrement;
do {
andDecrement = _availablePermits$FU.getAndDecrement(this);
} while (andDecrement > this.permits);
return andDecrement;
}
public void release() {
do {
int andIncrement = _availablePermits$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());
}
public final void coerceAvailablePermitsAtMaximum() {
AtomicIntegerFieldUpdater atomicIntegerFieldUpdater;
int i;
int i2;
do {
atomicIntegerFieldUpdater = _availablePermits$FU;
i = atomicIntegerFieldUpdater.get(this);
i2 = this.permits;
if (i <= i2) {
return;
}
} while (!atomicIntegerFieldUpdater.compareAndSet(this, i, i2));
}
public final boolean addAcquireToQueue(Waiter waiter) {
int i;
Object findSegmentInternal;
int i2;
Symbol symbol;
Symbol symbol2;
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = tail$FU;
SemaphoreSegment semaphoreSegment = (SemaphoreSegment) atomicReferenceFieldUpdater.get(this);
long andIncrement = enqIdx$FU.getAndIncrement(this);
SemaphoreImpl$addAcquireToQueue$createNewSegment$1 semaphoreImpl$addAcquireToQueue$createNewSegment$1 = SemaphoreImpl$addAcquireToQueue$createNewSegment$1.INSTANCE;
i = SemaphoreKt.SEGMENT_SIZE;
long j = andIncrement / i;
loop0: while (true) {
findSegmentInternal = ConcurrentLinkedListKt.findSegmentInternal(semaphoreSegment, j, semaphoreImpl$addAcquireToQueue$createNewSegment$1);
if (!SegmentOrClosed.m4152isClosedimpl(findSegmentInternal)) {
Segment m4151getSegmentimpl = SegmentOrClosed.m4151getSegmentimpl(findSegmentInternal);
while (true) {
Segment segment = (Segment) atomicReferenceFieldUpdater.get(this);
if (segment.id >= m4151getSegmentimpl.id) {
break loop0;
}
if (!m4151getSegmentimpl.tryIncPointers$kotlinx_coroutines_core()) {
break;
}
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(atomicReferenceFieldUpdater, this, segment, m4151getSegmentimpl)) {
if (segment.decPointers$kotlinx_coroutines_core()) {
segment.remove();
}
} else if (m4151getSegmentimpl.decPointers$kotlinx_coroutines_core()) {
m4151getSegmentimpl.remove();
}
}
} else {
break;
}
}
SemaphoreSegment semaphoreSegment2 = (SemaphoreSegment) SegmentOrClosed.m4151getSegmentimpl(findSegmentInternal);
i2 = SemaphoreKt.SEGMENT_SIZE;
int i3 = (int) (andIncrement % i2);
if (ChannelSegment$$ExternalSyntheticBackportWithForwarding0.m(semaphoreSegment2.getAcquirers(), i3, null, waiter)) {
waiter.invokeOnCancellation(semaphoreSegment2, i3);
return true;
}
symbol = SemaphoreKt.PERMIT;
symbol2 = SemaphoreKt.TAKEN;
if (!ChannelSegment$$ExternalSyntheticBackportWithForwarding0.m(semaphoreSegment2.getAcquirers(), i3, symbol, symbol2)) {
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);
return true;
}
throw new IllegalStateException(("unexpected: " + waiter).toString());
}
public final boolean tryResumeNextFromQueue() {
int i;
Object findSegmentInternal;
int i2;
Symbol symbol;
Symbol symbol2;
int i3;
Symbol symbol3;
Symbol symbol4;
Symbol symbol5;
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = head$FU;
SemaphoreSegment semaphoreSegment = (SemaphoreSegment) atomicReferenceFieldUpdater.get(this);
long andIncrement = deqIdx$FU.getAndIncrement(this);
i = SemaphoreKt.SEGMENT_SIZE;
long j = andIncrement / i;
SemaphoreImpl$tryResumeNextFromQueue$createNewSegment$1 semaphoreImpl$tryResumeNextFromQueue$createNewSegment$1 = SemaphoreImpl$tryResumeNextFromQueue$createNewSegment$1.INSTANCE;
loop0: while (true) {
findSegmentInternal = ConcurrentLinkedListKt.findSegmentInternal(semaphoreSegment, j, semaphoreImpl$tryResumeNextFromQueue$createNewSegment$1);
if (SegmentOrClosed.m4152isClosedimpl(findSegmentInternal)) {
break;
}
Segment m4151getSegmentimpl = SegmentOrClosed.m4151getSegmentimpl(findSegmentInternal);
while (true) {
Segment segment = (Segment) atomicReferenceFieldUpdater.get(this);
if (segment.id >= m4151getSegmentimpl.id) {
break loop0;
}
if (!m4151getSegmentimpl.tryIncPointers$kotlinx_coroutines_core()) {
break;
}
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(atomicReferenceFieldUpdater, this, segment, m4151getSegmentimpl)) {
if (segment.decPointers$kotlinx_coroutines_core()) {
segment.remove();
}
} else if (m4151getSegmentimpl.decPointers$kotlinx_coroutines_core()) {
m4151getSegmentimpl.remove();
}
}
}
SemaphoreSegment semaphoreSegment2 = (SemaphoreSegment) SegmentOrClosed.m4151getSegmentimpl(findSegmentInternal);
semaphoreSegment2.cleanPrev();
if (semaphoreSegment2.id > j) {
return false;
}
i2 = SemaphoreKt.SEGMENT_SIZE;
int i4 = (int) (andIncrement % i2);
symbol = SemaphoreKt.PERMIT;
Object andSet = semaphoreSegment2.getAcquirers().getAndSet(i4, symbol);
if (andSet == null) {
i3 = SemaphoreKt.MAX_SPIN_CYCLES;
for (int i5 = 0; i5 < i3; i5++) {
Object obj = semaphoreSegment2.getAcquirers().get(i4);
symbol5 = SemaphoreKt.TAKEN;
if (obj == symbol5) {
return true;
}
}
symbol3 = SemaphoreKt.PERMIT;
symbol4 = SemaphoreKt.BROKEN;
return !ChannelSegment$$ExternalSyntheticBackportWithForwarding0.m(semaphoreSegment2.getAcquirers(), i4, symbol3, symbol4);
}
symbol2 = SemaphoreKt.CANCELLED;
if (andSet == symbol2) {
return false;
}
return tryResumeAcquire(andSet);
}
public final boolean tryResumeAcquire(Object obj) {
if (obj instanceof CancellableContinuation) {
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;
}
throw new IllegalStateException(("unexpected: " + obj).toString());
}
}

View File

@@ -0,0 +1,31 @@
package kotlinx.coroutines.sync;
import kotlinx.coroutines.internal.Symbol;
import kotlinx.coroutines.internal.SystemPropsKt__SystemProps_commonKt;
/* loaded from: classes5.dex */
public abstract class SemaphoreKt {
public static final Symbol BROKEN;
public static final Symbol CANCELLED;
public static final int MAX_SPIN_CYCLES;
public static final Symbol PERMIT;
public static final int SEGMENT_SIZE;
public static final Symbol TAKEN;
public static final SemaphoreSegment createSegment(long j, SemaphoreSegment semaphoreSegment) {
return new SemaphoreSegment(j, semaphoreSegment, 0);
}
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;
}
}

View File

@@ -0,0 +1,41 @@
package kotlinx.coroutines.sync;
import java.util.concurrent.atomic.AtomicReferenceArray;
import kotlin.coroutines.CoroutineContext;
import kotlinx.coroutines.internal.Segment;
import kotlinx.coroutines.internal.Symbol;
/* loaded from: classes5.dex */
public final class SemaphoreSegment extends Segment {
public final AtomicReferenceArray acquirers;
public final AtomicReferenceArray getAcquirers() {
return this.acquirers;
}
public SemaphoreSegment(long j, SemaphoreSegment semaphoreSegment, int i) {
super(j, semaphoreSegment, i);
int i2;
i2 = SemaphoreKt.SEGMENT_SIZE;
this.acquirers = new AtomicReferenceArray(i2);
}
@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 i, Throwable th, CoroutineContext coroutineContext) {
Symbol symbol;
symbol = SemaphoreKt.CANCELLED;
getAcquirers().set(i, symbol);
onSlotCleaned();
}
public String toString() {
return "SemaphoreSegment[id=" + this.id + ", hashCode=" + hashCode() + ']';
}
}