package o;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.Nw, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public abstract class AbstractRunnableC0359Nw implements Runnable, Comparable, InterfaceC2567ts {
    private volatile Object _heap;
    public long l;
    public int m = -1;

    public AbstractRunnableC0359Nw(long j) {
        this.l = j;
    }

    @Override // o.InterfaceC2567ts
    public final void a() {
        synchronized (this) {
            try {
                Object obj = this._heap;
                C2943xq c2943xq = IJ.b;
                if (obj == c2943xq) {
                    return;
                }
                C0385Ow c0385Ow = obj instanceof C0385Ow ? (C0385Ow) obj : null;
                if (c0385Ow != null) {
                    synchronized (c0385Ow) {
                        Object obj2 = this._heap;
                        if ((obj2 instanceof C1878mf0 ? (C1878mf0) obj2 : null) != null) {
                            c0385Ow.b(this.m);
                        }
                    }
                }
                this._heap = c2943xq;
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public final int b(long j, C0385Ow c0385Ow, AbstractC0411Pw abstractC0411Pw) {
        synchronized (this) {
            if (this._heap == IJ.b) {
                return 2;
            }
            synchronized (c0385Ow) {
                try {
                    AbstractRunnableC0359Nw[] abstractRunnableC0359NwArr = c0385Ow.a;
                    AbstractRunnableC0359Nw abstractRunnableC0359Nw = abstractRunnableC0359NwArr != null ? abstractRunnableC0359NwArr[0] : null;
                    if (AbstractC0411Pw.r.get(abstractC0411Pw) != 0) {
                        return 1;
                    }
                    if (abstractRunnableC0359Nw == null) {
                        c0385Ow.c = j;
                    } else {
                        long j2 = abstractRunnableC0359Nw.l;
                        if (j2 - j < 0) {
                            j = j2;
                        }
                        if (j - c0385Ow.c > 0) {
                            c0385Ow.c = j;
                        }
                    }
                    long j3 = this.l;
                    long j4 = c0385Ow.c;
                    if (j3 - j4 < 0) {
                        this.l = j4;
                    }
                    c0385Ow.a(this);
                    return 0;
                } catch (Throwable th) {
                    throw th;
                }
            }
        }
    }

    @Override // java.lang.Comparable
    public final int compareTo(Object obj) {
        long j = this.l - ((AbstractRunnableC0359Nw) obj).l;
        if (j > 0) {
            return 1;
        }
        return j < 0 ? -1 : 0;
    }

    public final void d(C0385Ow c0385Ow) {
        if (this._heap == IJ.b) {
            throw new IllegalArgumentException("Failed requirement.");
        }
        this._heap = c0385Ow;
    }

    public String toString() {
        return "Delayed[nanos=" + this.l + ']';
    }
}
