package kotlinx.coroutines.internal; import p012d1.C0639g; import p012d1.InterfaceC0633f; import p060t1.AbstractC1717u; import p060t1.C1659b0; import p060t1.C1728x; import p060t1.InterfaceC1665c0; /* renamed from: kotlinx.coroutines.internal.h */ /* loaded from: classes.dex */ public final class RunnableC1365h extends AbstractC1717u implements Runnable, InterfaceC1665c0 { /* renamed from: e */ public final AbstractC1717u f3036e; /* renamed from: f */ public final int f3037f; /* renamed from: g */ public final /* synthetic */ InterfaceC1665c0 f3038g; /* renamed from: h */ public final C1372m f3039h; /* renamed from: i */ public final Object f3040i; private volatile int runningWorkers; public RunnableC1365h(AbstractC1717u abstractC1717u, int i) { this.f3036e = abstractC1717u; this.f3037f = i; InterfaceC1665c0 interfaceC1665c0 = abstractC1717u instanceof InterfaceC1665c0 ? (InterfaceC1665c0) abstractC1717u : null; this.f3038g = interfaceC1665c0 == null ? C1659b0.m681a() : interfaceC1665c0; this.f3039h = new C1372m<>(false); this.f3040i = new Object(); } @Override // p060t1.AbstractC1717u /* renamed from: d */ public void mo478d(InterfaceC0633f interfaceC0633f, Runnable runnable) { if (!m1534n(runnable) && m1533o()) { this.f3036e.mo478d(this, this); } } /* renamed from: n */ public final boolean m1534n(Runnable runnable) { this.f3039h.m1514a(runnable); return this.runningWorkers >= this.f3037f; } /* renamed from: o */ public final boolean m1533o() { synchronized (this.f3040i) { if (this.runningWorkers >= this.f3037f) { return false; } this.runningWorkers++; return true; } } /* JADX WARN: Code restructure failed: missing block: B:16:0x002a, code lost: r1 = r4.f3040i; */ /* JADX WARN: Code restructure failed: missing block: B:17:0x002c, code lost: monitor-enter(r1); */ /* JADX WARN: Code restructure failed: missing block: B:18:0x002d, code lost: r4.runningWorkers--; */ /* JADX WARN: Code restructure failed: missing block: B:19:0x0039, code lost: if (r4.f3039h.m1512c() != 0) goto L28; */ /* JADX WARN: Code restructure failed: missing block: B:20:0x003b, code lost: monitor-exit(r1); */ /* JADX WARN: Code restructure failed: missing block: B:21:0x003c, code lost: return; */ /* JADX WARN: Code restructure failed: missing block: B:22:0x003d, code lost: r4.runningWorkers++; r2 = p006b1.C0484l.f1690a; */ @Override // java.lang.Runnable /* Code decompiled incorrectly, please refer to instructions dump. */ public void run() { Object obj; while (true) { int i = 0; while (true) { Runnable m1511d = this.f3039h.m1511d(); if (m1511d == null) { break; } try { m1511d.run(); } catch (Throwable th) { C1728x.m499a(C0639g.f2162d, th); } i++; if (i >= 16 && this.f3036e.mo477f(this)) { this.f3036e.mo478d(this, this); return; } } } } }