- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
51 lines
1.8 KiB
Java
51 lines
1.8 KiB
Java
package kotlinx.coroutines.internal;
|
|
|
|
import androidx.core.internal.view.SupportMenu;
|
|
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
|
|
import kotlin.coroutines.CoroutineContext;
|
|
import kotlinx.coroutines.NotCompleted;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public abstract class Segment extends ConcurrentLinkedListNode implements NotCompleted {
|
|
public static final AtomicIntegerFieldUpdater cleanedAndPointers$FU = AtomicIntegerFieldUpdater.newUpdater(Segment.class, "cleanedAndPointers");
|
|
private volatile int cleanedAndPointers;
|
|
public final long id;
|
|
|
|
public abstract int getNumberOfSlots();
|
|
|
|
public abstract void onCancellation(int i, Throwable th, CoroutineContext coroutineContext);
|
|
|
|
public Segment(long j, Segment segment, int i) {
|
|
super(segment);
|
|
this.id = j;
|
|
this.cleanedAndPointers = i << 16;
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.internal.ConcurrentLinkedListNode
|
|
public boolean isRemoved() {
|
|
return cleanedAndPointers$FU.get(this) == getNumberOfSlots() && !isTail();
|
|
}
|
|
|
|
public final boolean decPointers$kotlinx_coroutines_core() {
|
|
return cleanedAndPointers$FU.addAndGet(this, SupportMenu.CATEGORY_MASK) == getNumberOfSlots() && !isTail();
|
|
}
|
|
|
|
public final void onSlotCleaned() {
|
|
if (cleanedAndPointers$FU.incrementAndGet(this) == getNumberOfSlots()) {
|
|
remove();
|
|
}
|
|
}
|
|
|
|
public final boolean tryIncPointers$kotlinx_coroutines_core() {
|
|
int i;
|
|
AtomicIntegerFieldUpdater atomicIntegerFieldUpdater = cleanedAndPointers$FU;
|
|
do {
|
|
i = atomicIntegerFieldUpdater.get(this);
|
|
if (i == getNumberOfSlots() && !isTail()) {
|
|
return false;
|
|
}
|
|
} while (!atomicIntegerFieldUpdater.compareAndSet(this, i, 65536 + i));
|
|
return true;
|
|
}
|
|
}
|