package v; import android.os.CancellationSignal; /* loaded from: classes.dex */ public final class b { /* renamed from: a, reason: collision with root package name */ private boolean f14763a; /* renamed from: b, reason: collision with root package name */ private a f14764b; /* renamed from: c, reason: collision with root package name */ private Object f14765c; /* renamed from: d, reason: collision with root package name */ private boolean f14766d; public interface a { void a(); } private void d() { while (this.f14766d) { try { wait(); } catch (InterruptedException unused) { } } } public void a() { synchronized (this) { if (this.f14763a) { return; } this.f14763a = true; this.f14766d = true; a aVar = this.f14764b; Object obj = this.f14765c; if (aVar != null) { try { aVar.a(); } catch (Throwable th) { synchronized (this) { this.f14766d = false; notifyAll(); throw th; } } } if (obj != null) { ((CancellationSignal) obj).cancel(); } synchronized (this) { this.f14766d = false; notifyAll(); } } } public boolean b() { boolean z10; synchronized (this) { z10 = this.f14763a; } return z10; } public void c(a aVar) { synchronized (this) { d(); if (this.f14764b == aVar) { return; } this.f14764b = aVar; if (this.f14763a && aVar != null) { aVar.a(); } } } }