126 lines
3.6 KiB
Java
126 lines
3.6 KiB
Java
|
package o;
|
||
|
|
||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||
|
import java.util.concurrent.atomic.AtomicLong;
|
||
|
import java.util.concurrent.atomic.AtomicReference;
|
||
|
|
||
|
/* renamed from: o.fUt, reason: case insensitive filesystem */
|
||
|
/* loaded from: classes6.dex */
|
||
|
abstract class AbstractC13241fUt<T, R> extends AtomicInteger implements InterfaceC13158fSf<T>, InterfaceC15337gnm {
|
||
|
private InterfaceC15338gnn<? super R> b;
|
||
|
private volatile boolean c;
|
||
|
private volatile boolean d;
|
||
|
private Throwable e;
|
||
|
private InterfaceC15337gnm g;
|
||
|
private AtomicLong f = new AtomicLong();
|
||
|
final AtomicReference<R> a = new AtomicReference<>();
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public AbstractC13241fUt(InterfaceC15338gnn<? super R> interfaceC15338gnn) {
|
||
|
this.b = interfaceC15338gnn;
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC13158fSf, o.InterfaceC15338gnn
|
||
|
public final void c(InterfaceC15337gnm interfaceC15337gnm) {
|
||
|
if (fYC.e(this.g, interfaceC15337gnm)) {
|
||
|
this.g = interfaceC15337gnm;
|
||
|
this.b.c(this);
|
||
|
interfaceC15337gnm.c(Long.MAX_VALUE);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC15338gnn
|
||
|
public void onError(Throwable th) {
|
||
|
this.e = th;
|
||
|
this.d = true;
|
||
|
c();
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC15338gnn
|
||
|
public void onComplete() {
|
||
|
this.d = true;
|
||
|
c();
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC15337gnm
|
||
|
public final void c(long j) {
|
||
|
if (fYC.e(j)) {
|
||
|
fYK.c(this.f, j);
|
||
|
c();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC15337gnm
|
||
|
public final void a() {
|
||
|
if (this.c) {
|
||
|
return;
|
||
|
}
|
||
|
this.c = true;
|
||
|
this.g.a();
|
||
|
if (getAndIncrement() == 0) {
|
||
|
this.a.lazySet(null);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public final void c() {
|
||
|
if (getAndIncrement() != 0) {
|
||
|
return;
|
||
|
}
|
||
|
InterfaceC15338gnn<? super R> interfaceC15338gnn = this.b;
|
||
|
AtomicLong atomicLong = this.f;
|
||
|
AtomicReference<R> atomicReference = this.a;
|
||
|
int i = 1;
|
||
|
do {
|
||
|
long j = 0;
|
||
|
while (true) {
|
||
|
if (j == atomicLong.get()) {
|
||
|
break;
|
||
|
}
|
||
|
boolean z = this.d;
|
||
|
R andSet = atomicReference.getAndSet(null);
|
||
|
boolean z2 = andSet == null;
|
||
|
if (!d(z, z2, interfaceC15338gnn, atomicReference)) {
|
||
|
if (z2) {
|
||
|
break;
|
||
|
}
|
||
|
interfaceC15338gnn.onNext(andSet);
|
||
|
j++;
|
||
|
} else {
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
if (j == atomicLong.get()) {
|
||
|
if (d(this.d, atomicReference.get() == null, interfaceC15338gnn, atomicReference)) {
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
if (j != 0) {
|
||
|
fYK.b(atomicLong, j);
|
||
|
}
|
||
|
i = addAndGet(-i);
|
||
|
} while (i != 0);
|
||
|
}
|
||
|
|
||
|
private boolean d(boolean z, boolean z2, InterfaceC15338gnn<?> interfaceC15338gnn, AtomicReference<R> atomicReference) {
|
||
|
if (this.c) {
|
||
|
atomicReference.lazySet(null);
|
||
|
return true;
|
||
|
}
|
||
|
if (!z) {
|
||
|
return false;
|
||
|
}
|
||
|
Throwable th = this.e;
|
||
|
if (th != null) {
|
||
|
atomicReference.lazySet(null);
|
||
|
interfaceC15338gnn.onError(th);
|
||
|
return true;
|
||
|
}
|
||
|
if (!z2) {
|
||
|
return false;
|
||
|
}
|
||
|
interfaceC15338gnn.onComplete();
|
||
|
return true;
|
||
|
}
|
||
|
}
|