74 lines
2.3 KiB
Java
74 lines
2.3 KiB
Java
package o;
|
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
/* renamed from: o.gix, reason: case insensitive filesystem */
|
|
/* loaded from: classes.dex */
|
|
public final class C15169gix {
|
|
private static final int a;
|
|
private static final C15170giy b;
|
|
private static final AtomicReference<C15170giy>[] d;
|
|
private static final int e;
|
|
|
|
private C15169gix() {
|
|
}
|
|
|
|
static {
|
|
new C15169gix();
|
|
e = 65536;
|
|
b = new C15170giy(new byte[0], 0, 0, false, false);
|
|
int highestOneBit = Integer.highestOneBit((Runtime.getRuntime().availableProcessors() << 1) - 1);
|
|
a = highestOneBit;
|
|
AtomicReference<C15170giy>[] atomicReferenceArr = new AtomicReference[highestOneBit];
|
|
for (int i = 0; i < highestOneBit; i++) {
|
|
atomicReferenceArr[i] = new AtomicReference<>();
|
|
}
|
|
d = atomicReferenceArr;
|
|
}
|
|
|
|
public static final void e(C15170giy c15170giy) {
|
|
C14957gcv.e(c15170giy, "");
|
|
if (c15170giy.a != null || c15170giy.h != null) {
|
|
throw new IllegalArgumentException("Failed requirement.".toString());
|
|
}
|
|
if (c15170giy.i) {
|
|
return;
|
|
}
|
|
AtomicReference<C15170giy> atomicReference = d[(int) (Thread.currentThread().getId() & (a - 1))];
|
|
C15170giy c15170giy2 = atomicReference.get();
|
|
if (c15170giy2 == b) {
|
|
return;
|
|
}
|
|
int i = c15170giy2 != null ? c15170giy2.d : 0;
|
|
if (i >= e) {
|
|
return;
|
|
}
|
|
c15170giy.a = c15170giy2;
|
|
c15170giy.e = 0;
|
|
c15170giy.d = i + 8192;
|
|
while (!atomicReference.compareAndSet(c15170giy2, c15170giy)) {
|
|
if (atomicReference.get() != c15170giy2) {
|
|
c15170giy.a = null;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
public static final C15170giy d() {
|
|
AtomicReference<C15170giy> atomicReference = d[(int) (Thread.currentThread().getId() & (a - 1))];
|
|
C15170giy c15170giy = b;
|
|
C15170giy andSet = atomicReference.getAndSet(c15170giy);
|
|
if (andSet == c15170giy) {
|
|
return new C15170giy();
|
|
}
|
|
if (andSet == null) {
|
|
atomicReference.set(null);
|
|
return new C15170giy();
|
|
}
|
|
atomicReference.set(andSet.a);
|
|
andSet.a = null;
|
|
andSet.d = 0;
|
|
return andSet;
|
|
}
|
|
}
|