2021-06-27 20:44:35 +00:00
|
|
|
package j0.l.a;
|
|
|
|
|
|
|
|
import java.util.Objects;
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
import rx.Producer;
|
|
|
|
import rx.Subscriber;
|
|
|
|
/* compiled from: DeferredScalarSubscriber */
|
|
|
|
public abstract class a<T, R> extends Subscriber<T> {
|
|
|
|
public final Subscriber<? super R> i;
|
|
|
|
public boolean j;
|
|
|
|
public R k;
|
|
|
|
public final AtomicInteger l = new AtomicInteger();
|
|
|
|
|
|
|
|
/* compiled from: DeferredScalarSubscriber */
|
|
|
|
/* renamed from: j0.l.a.a$a reason: collision with other inner class name */
|
2021-07-20 22:20:08 +00:00
|
|
|
public static final class C0320a implements Producer {
|
2021-06-27 20:44:35 +00:00
|
|
|
public final a<?, ?> i;
|
|
|
|
|
2021-07-20 22:20:08 +00:00
|
|
|
public C0320a(a<?, ?> aVar) {
|
2021-06-27 20:44:35 +00:00
|
|
|
this.i = aVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // rx.Producer
|
|
|
|
public void j(long j) {
|
|
|
|
a<?, ?> aVar = this.i;
|
|
|
|
Objects.requireNonNull(aVar);
|
|
|
|
int i = (j > 0 ? 1 : (j == 0 ? 0 : -1));
|
|
|
|
if (i < 0) {
|
2021-07-27 04:36:47 +00:00
|
|
|
throw new IllegalArgumentException(c.d.b.a.a.o("n >= 0 required but it was ", j));
|
2021-06-27 20:44:35 +00:00
|
|
|
} else if (i != 0) {
|
|
|
|
Subscriber<? super Object> subscriber = aVar.i;
|
|
|
|
do {
|
|
|
|
int i2 = aVar.l.get();
|
|
|
|
if (i2 != 1 && i2 != 3 && !subscriber.isUnsubscribed()) {
|
|
|
|
if (i2 == 2) {
|
|
|
|
if (aVar.l.compareAndSet(2, 3)) {
|
|
|
|
subscriber.onNext(aVar.k);
|
|
|
|
if (!subscriber.isUnsubscribed()) {
|
|
|
|
subscriber.onCompleted();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} while (!aVar.l.compareAndSet(0, 1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public a(Subscriber<? super R> subscriber) {
|
|
|
|
this.i = subscriber;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // rx.Subscriber
|
|
|
|
public final void setProducer(Producer producer) {
|
|
|
|
producer.j(Long.MAX_VALUE);
|
|
|
|
}
|
|
|
|
}
|