package d1; import java.util.ArrayDeque; import java.util.concurrent.Executor; /* loaded from: classes.dex */ public class k implements Executor { /* renamed from: b, reason: collision with root package name */ private final Executor f9002b; /* renamed from: d, reason: collision with root package name */ private volatile Runnable f9004d; /* renamed from: a, reason: collision with root package name */ private final ArrayDeque f9001a = new ArrayDeque(); /* renamed from: c, reason: collision with root package name */ private final Object f9003c = new Object(); static class a implements Runnable { /* renamed from: a, reason: collision with root package name */ final k f9005a; /* renamed from: b, reason: collision with root package name */ final Runnable f9006b; a(k kVar, Runnable runnable) { this.f9005a = kVar; this.f9006b = runnable; } @Override // java.lang.Runnable public void run() { try { this.f9006b.run(); } finally { this.f9005a.b(); } } } public k(Executor executor) { this.f9002b = executor; } public boolean a() { boolean z10; synchronized (this.f9003c) { z10 = !this.f9001a.isEmpty(); } return z10; } void b() { synchronized (this.f9003c) { Runnable runnable = (Runnable) this.f9001a.poll(); this.f9004d = runnable; if (runnable != null) { this.f9002b.execute(this.f9004d); } } } @Override // java.util.concurrent.Executor public void execute(Runnable runnable) { synchronized (this.f9003c) { this.f9001a.add(new a(this, runnable)); if (this.f9004d == null) { b(); } } } }