60 lines
1.9 KiB
Java
60 lines
1.9 KiB
Java
|
package o;
|
||
|
|
||
|
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public class ggZ<E> {
|
||
|
private static final AtomicReferenceFieldUpdater c = AtomicReferenceFieldUpdater.newUpdater(ggZ.class, Object.class, "_cur");
|
||
|
volatile Object _cur = new ggX(8, false);
|
||
|
|
||
|
public final int b() {
|
||
|
long j = ((ggX) this._cur)._state;
|
||
|
return (((int) ((j & 1152921503533105152L) >> 30)) - ((int) (1073741823 & j))) & 1073741823;
|
||
|
}
|
||
|
|
||
|
public final void a() {
|
||
|
while (true) {
|
||
|
ggX ggx = (ggX) this._cur;
|
||
|
if (ggx.e()) {
|
||
|
return;
|
||
|
}
|
||
|
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = c;
|
||
|
ggX<E> c2 = ggx.c(ggx.b());
|
||
|
while (!atomicReferenceFieldUpdater.compareAndSet(this, ggx, c2) && atomicReferenceFieldUpdater.get(this) == ggx) {
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final boolean e(E e) {
|
||
|
while (true) {
|
||
|
ggX ggx = (ggX) this._cur;
|
||
|
int d = ggx.d(e);
|
||
|
if (d == 0) {
|
||
|
return true;
|
||
|
}
|
||
|
if (d == 1) {
|
||
|
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = c;
|
||
|
ggX<E> c2 = ggx.c(ggx.b());
|
||
|
while (!atomicReferenceFieldUpdater.compareAndSet(this, ggx, c2) && atomicReferenceFieldUpdater.get(this) == ggx) {
|
||
|
}
|
||
|
} else if (d == 2) {
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final E c() {
|
||
|
while (true) {
|
||
|
ggX ggx = (ggX) this._cur;
|
||
|
E e = (E) ggx.a();
|
||
|
if (e != ggX.e) {
|
||
|
return e;
|
||
|
}
|
||
|
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = c;
|
||
|
ggX<E> c2 = ggx.c(ggx.b());
|
||
|
while (!atomicReferenceFieldUpdater.compareAndSet(this, ggx, c2) && atomicReferenceFieldUpdater.get(this) == ggx) {
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|