package p138.p176.p177.p242.p265.p266;

import android.os.Process;
import java.util.concurrent.BlockingQueue;
import p000.p001.p002.p003.p004.C0567;

/* JADX INFO: renamed from: ދ.ހ.֏.ހ.ބ.֏.ྋ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C5007 extends Thread {

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public final Object f15138;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public final BlockingQueue<C4894<?>> f15139;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public boolean f15140 = false;

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public final /* synthetic */ C4771 f15141;

    public C5007(C4771 c4771, String str, BlockingQueue<C4894<?>> blockingQueue) {
        this.f15141 = c4771;
        C0567.m1910(str);
        C0567.m1910(blockingQueue);
        this.f15138 = new Object();
        this.f15139 = blockingQueue;
        setName(str);
    }

    @Override // java.lang.Thread, java.lang.Runnable
    public final void run() {
        boolean z = false;
        while (!z) {
            try {
                this.f15141.f14388.acquire();
                z = true;
            } catch (InterruptedException e) {
                m8530(e);
            }
        }
        try {
            int threadPriority = Process.getThreadPriority(Process.myTid());
            while (true) {
                C4894<?> c4894Poll = this.f15139.poll();
                if (c4894Poll == null) {
                    synchronized (this.f15138) {
                        if (this.f15139.peek() == null && !this.f15141.f14389) {
                            try {
                                this.f15138.wait(30000L);
                            } catch (InterruptedException e2) {
                                m8530(e2);
                            }
                        }
                    }
                    synchronized (this.f15141.f14387) {
                        if (this.f15139.peek() == null) {
                            break;
                        }
                    }
                } else {
                    Process.setThreadPriority(c4894Poll.f14758 ? threadPriority : 10);
                    c4894Poll.run();
                }
            }
            if (this.f15141.f14588.f15015.m8177(C4915.f14906)) {
                m8531();
            }
        } finally {
            m8531();
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m8529() {
        synchronized (this.f15138) {
            this.f15138.notifyAll();
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m8530(InterruptedException interruptedException) {
        this.f15141.mo8165().f14447.m8035(String.valueOf(getName()).concat(" was interrupted"), interruptedException);
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final void m8531() {
        synchronized (this.f15141.f14387) {
            if (!this.f15140) {
                this.f15141.f14388.release();
                this.f15141.f14387.notifyAll();
                if (this == this.f15141.f14381) {
                    this.f15141.f14381 = null;
                } else if (this == this.f15141.f14382) {
                    this.f15141.f14382 = null;
                } else {
                    this.f15141.mo8165().f14444.m8034("Current scheduler thread is neither worker nor network");
                }
                this.f15140 = true;
            }
        }
    }
}
