package org.greenrobot.eventbus;

import android.util.Log;

/* JADX INFO: compiled from: BackgroundPoster.java */
/* JADX INFO: loaded from: classes.dex */
final class b implements Runnable {

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private final i f3333c = new i();

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private final c f3334d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private volatile boolean f3335e;

    b(c cVar) {
        this.f3334d = cVar;
    }

    public void a(n nVar, Object obj) {
        h hVarA = h.a(nVar, obj);
        synchronized (this) {
            this.f3333c.a(hVarA);
            if (!this.f3335e) {
                this.f3335e = true;
                this.f3334d.d().execute(this);
            }
        }
    }

    @Override // java.lang.Runnable
    public void run() {
        h hVarC;
        while (true) {
            try {
                hVarC = this.f3333c.c(1000);
            } catch (InterruptedException e2) {
                Log.w("Event", Thread.currentThread().getName() + " was interruppted", e2);
                return;
            } finally {
                this.f3335e = false;
            }
            if (hVarC == null) {
                synchronized (this) {
                    hVarC = this.f3333c.b();
                    if (hVarC == null) {
                        return;
                    }
                    this.f3335e = false;
                }
            }
            this.f3334d.f(hVarC);
        }
    }
}
