2021-10-19 23:48:27 +00:00
|
|
|
package i0.l.a;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
2021-10-19 23:48:27 +00:00
|
|
|
import i0.m.b;
|
|
|
|
import i0.r.a;
|
2021-06-27 20:44:35 +00:00
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
import java.util.concurrent.locks.ReentrantLock;
|
|
|
|
import rx.Observable;
|
|
|
|
import rx.Subscriber;
|
|
|
|
import rx.subscriptions.CompositeSubscription;
|
|
|
|
/* compiled from: OnSubscribeRefCount */
|
|
|
|
public final class c0<T> implements Observable.a<T> {
|
2021-09-29 00:45:08 +00:00
|
|
|
public final b<? extends T> i;
|
2021-06-27 20:44:35 +00:00
|
|
|
public volatile CompositeSubscription j = new CompositeSubscription();
|
|
|
|
public final AtomicInteger k = new AtomicInteger(0);
|
|
|
|
public final ReentrantLock l = new ReentrantLock();
|
|
|
|
|
2021-09-29 00:45:08 +00:00
|
|
|
public c0(b<? extends T> bVar) {
|
|
|
|
this.i = bVar;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // rx.functions.Action1
|
|
|
|
public void call(Object obj) {
|
|
|
|
Subscriber subscriber = (Subscriber) obj;
|
|
|
|
this.l.lock();
|
|
|
|
if (this.k.incrementAndGet() == 1) {
|
|
|
|
AtomicBoolean atomicBoolean = new AtomicBoolean(true);
|
|
|
|
try {
|
2021-10-26 23:51:06 +00:00
|
|
|
this.i.k0(new z(this, subscriber, atomicBoolean));
|
2021-06-27 20:44:35 +00:00
|
|
|
} finally {
|
|
|
|
if (atomicBoolean.get()) {
|
|
|
|
this.l.unlock();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
try {
|
|
|
|
CompositeSubscription compositeSubscription = this.j;
|
|
|
|
subscriber.add(new a(new b0(this, compositeSubscription)));
|
2021-10-26 23:51:06 +00:00
|
|
|
this.i.i0(new a0(this, subscriber, subscriber, compositeSubscription));
|
2021-06-27 20:44:35 +00:00
|
|
|
} finally {
|
|
|
|
this.l.unlock();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|