package defpackage;

import androidx.media3.container.NalUnitUtil;
import kotlin.Metadata;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\b \u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lbq2;", "Llj1;", "kotlinx-coroutines-core"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
@vx8
public abstract class bq2 extends lj1 {
    public static final /* synthetic */ int f = 0;
    public long c;
    public boolean d;
    public ds e;

    public final void bz(boolean z) {
        long j = this.c - (z ? 4294967296L : 1L);
        this.c = j;
        if (j <= 0 && this.d) {
            shutdown();
        }
    }

    public final void cc(oc2 oc2Var) {
        ds dsVar = this.e;
        if (dsVar == null) {
            dsVar = new ds();
            this.e = dsVar;
        }
        dsVar.addLast(oc2Var);
    }

    public final void ch(boolean z) {
        this.c = (z ? 4294967296L : 1L) + this.c;
        if (z) {
            return;
        }
        this.d = true;
    }

    public long ci() {
        return !cj() ? Long.MAX_VALUE : 0L;
    }

    public final boolean cj() {
        ds dsVar = this.e;
        if (dsVar == null) {
            return false;
        }
        oc2 oc2Var = (oc2) (dsVar.isEmpty() ? null : dsVar.removeFirst());
        if (oc2Var == null) {
            return false;
        }
        oc2Var.run();
        return true;
    }

    public void shutdown() {
    }
}
