package o; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; import o.AbstractC13173fSu; /* renamed from: o.fYw, reason: case insensitive filesystem */ /* loaded from: classes.dex */ public final class C13384fYw extends AbstractC13173fSu { static final RVV b; private static ThreadFactoryC13387fYz c; private static LWm d; private static int e; private ThreadFactory i; private AtomicReference j; static { int availableProcessors = Runtime.getRuntime().availableProcessors(); int intValue = Integer.getInteger("rx3.computation-threads", 0).intValue(); if (intValue > 0 && intValue <= availableProcessors) { availableProcessors = intValue; } e = availableProcessors; RVV rvv = new RVV(new ThreadFactoryC13387fYz("RxComputationShutdown")); b = rvv; rvv.dispose(); ThreadFactoryC13387fYz threadFactoryC13387fYz = new ThreadFactoryC13387fYz("RxComputationThreadPool", Math.max(1, Math.min(10, Integer.getInteger("rx3.computation-priority", 5).intValue())), true); c = threadFactoryC13387fYz; LWm lWm = new LWm(0, threadFactoryC13387fYz); d = lWm; for (RVV rvv2 : lWm.c) { rvv2.dispose(); } } /* renamed from: o.fYw$LWm */ /* loaded from: classes.dex */ static final class LWm { RVV[] c; private int d; private long e; LWm(int i, ThreadFactory threadFactory) { this.d = i; this.c = new RVV[i]; for (int i2 = 0; i2 < i; i2++) { this.c[i2] = new RVV(threadFactory); } } public final RVV a() { int i = this.d; if (i == 0) { return C13384fYw.b; } RVV[] rvvArr = this.c; long j = this.e; this.e = 1 + j; return rvvArr[(int) (j % i)]; } } public C13384fYw() { this(c); } private C13384fYw(ThreadFactory threadFactory) { this.i = threadFactory; this.j = new AtomicReference<>(d); b(); } @Override // o.AbstractC13173fSu public final AbstractC13173fSu.Sts c() { return new IeS(this.j.get().a()); } @Override // o.AbstractC13173fSu public final fSJ d(Runnable runnable, long j, TimeUnit timeUnit) { return this.j.get().a().d(runnable, j, timeUnit); } @Override // o.AbstractC13173fSu public final fSJ d(Runnable runnable, long j, long j2, TimeUnit timeUnit) { return this.j.get().a().c(runnable, j, j2, timeUnit); } @Override // o.AbstractC13173fSu public final void b() { LWm lWm = new LWm(e, this.i); AtomicReference atomicReference = this.j; LWm lWm2 = d; while (!atomicReference.compareAndSet(lWm2, lWm)) { if (atomicReference.get() != lWm2) { for (RVV rvv : lWm.c) { rvv.dispose(); } return; } } } /* renamed from: o.fYw$IeS */ /* loaded from: classes6.dex */ static final class IeS extends AbstractC13173fSu.Sts { private final C13196fTj a; private final RVV b; private volatile boolean c; private final C13196fTj d; private final fSC e; IeS(RVV rvv) { this.b = rvv; C13196fTj c13196fTj = new C13196fTj(); this.a = c13196fTj; fSC fsc = new fSC(); this.e = fsc; C13196fTj c13196fTj2 = new C13196fTj(); this.d = c13196fTj2; c13196fTj2.e(c13196fTj); c13196fTj2.e(fsc); } @Override // o.fSJ public final void dispose() { if (this.c) { return; } this.c = true; this.d.dispose(); } @Override // o.AbstractC13173fSu.Sts public final fSJ c(Runnable runnable) { if (this.c) { return EnumC13195fTi.INSTANCE; } return this.b.c(runnable, 0L, TimeUnit.MILLISECONDS, this.a); } @Override // o.AbstractC13173fSu.Sts public final fSJ a(Runnable runnable, long j, TimeUnit timeUnit) { if (this.c) { return EnumC13195fTi.INSTANCE; } return this.b.c(runnable, j, timeUnit, this.e); } @Override // o.fSJ public final boolean isDisposed() { return this.c; } } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.fYw$RVV */ /* loaded from: classes.dex */ public static final class RVV extends C13380fYs { RVV(ThreadFactory threadFactory) { super(threadFactory); } } }