package defpackage;

import android.os.Process;
import java.util.concurrent.BlockingQueue;

/* JADX INFO: renamed from: ᵚʛ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C2696 extends Thread {

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public final Object f10379;

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public boolean f10380 = false;

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public final BlockingQueue f10381;

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public final /* synthetic */ C1961 f10382;

    public C2696(C1961 c1961, String str, BlockingQueue blockingQueue) {
        this.f10382 = c1961;
        ᵘᵞʿⁱ.ᵶᵥᵝ(blockingQueue);
        this.f10379 = new Object();
        this.f10381 = blockingQueue;
        setName(str);
    }

    @Override // java.lang.Thread, java.lang.Runnable
    public final void run() {
        boolean z = false;
        while (!z) {
            try {
                this.f10382.f7789.acquire();
                z = true;
            } catch (InterruptedException e) {
                C3485 c3485 = ((C1103) ((ᵜᵪʾ) this.f10382).ˌᴵ).f4729;
                C1103.m3564(c3485);
                c3485.f13424.m4474(e, String.valueOf(getName()).concat(" was interrupted"));
            }
        }
        try {
            int threadPriority = Process.getThreadPriority(Process.myTid());
            while (true) {
                BlockingQueue blockingQueue = this.f10381;
                C4276 c4276 = (C4276) blockingQueue.poll();
                if (c4276 != null) {
                    Process.setThreadPriority(true != c4276.f16333 ? 10 : threadPriority);
                    c4276.run();
                } else {
                    Object obj = this.f10379;
                    synchronized (obj) {
                        if (blockingQueue.peek() == null) {
                            this.f10382.getClass();
                            try {
                                obj.wait(30000L);
                            } catch (InterruptedException e2) {
                                C3485 c34852 = ((C1103) ((ᵜᵪʾ) this.f10382).ˌᴵ).f4729;
                                C1103.m3564(c34852);
                                c34852.f13424.m4474(e2, String.valueOf(getName()).concat(" was interrupted"));
                            }
                        }
                    }
                    synchronized (this.f10382.f7794) {
                        if (this.f10381.peek() == null) {
                            m6506();
                            m6506();
                            return;
                        }
                    }
                }
            }
        } catch (Throwable th) {
            m6506();
            throw th;
        }
    }

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final void m6506() {
        C1961 c1961 = this.f10382;
        synchronized (c1961.f7794) {
            try {
                if (!this.f10380) {
                    c1961.f7789.release();
                    c1961.f7794.notifyAll();
                    if (this == c1961.f7790) {
                        c1961.f7790 = null;
                    } else if (this == c1961.f7791) {
                        c1961.f7791 = null;
                    } else {
                        C3485 c3485 = ((C1103) ((ᵜᵪʾ) c1961).ˌᴵ).f4729;
                        C1103.m3564(c3485);
                        c3485.f13423.m4476("Current scheduler thread is neither worker nor network");
                    }
                    this.f10380 = true;
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final void m6507() {
        Object obj = this.f10379;
        synchronized (obj) {
            obj.notifyAll();
        }
    }
}
