package defpackage;

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

/* renamed from: ᵪˌᵱ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C3881 extends Thread {

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public final BlockingQueue f14426;

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public final Object f14427;

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public final /* synthetic */ C1325 f14428;

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public boolean f14429 = false;

    public C3881(C1325 c1325, String str, BlockingQueue blockingQueue) {
        this.f14428 = c1325;
        ᵩʛʽ.ᵝᵵᵺ(blockingQueue);
        this.f14427 = new Object();
        this.f14426 = blockingQueue;
        setName(str);
    }

    @Override // java.lang.Thread, java.lang.Runnable
    public final void run() throws InterruptedException {
        boolean z = false;
        while (!z) {
            try {
                this.f14428.f5435.acquire();
                z = true;
            } catch (InterruptedException e) {
                C1736 c1736 = ((C4205) ((ᵢˇᵭ) this.f14428).ᵧᵾˀˈ).f15715;
                C4205.m9132(c1736);
                c1736.f6934.m6039(e, String.valueOf(getName()).concat(" was interrupted"));
            }
        }
        try {
            int threadPriority = Process.getThreadPriority(Process.myTid());
            while (true) {
                BlockingQueue blockingQueue = this.f14426;
                C4324 c4324 = (C4324) blockingQueue.poll();
                if (c4324 != null) {
                    Process.setThreadPriority(true != c4324.f16189 ? 10 : threadPriority);
                    c4324.run();
                } else {
                    Object obj = this.f14427;
                    synchronized (obj) {
                        if (blockingQueue.peek() == null) {
                            this.f14428.getClass();
                            try {
                                obj.wait(30000L);
                            } catch (InterruptedException e2) {
                                C1736 c17362 = ((C4205) ((ᵢˇᵭ) this.f14428).ᵧᵾˀˈ).f15715;
                                C4205.m9132(c17362);
                                c17362.f6934.m6039(e2, String.valueOf(getName()).concat(" was interrupted"));
                            }
                        }
                    }
                    synchronized (this.f14428.f5436) {
                        if (this.f14426.peek() == null) {
                            m8535();
                            m8535();
                            return;
                        }
                    }
                }
            }
        } catch (Throwable th) {
            m8535();
            throw th;
        }
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final void m8534() {
        Object obj = this.f14427;
        synchronized (obj) {
            obj.notifyAll();
        }
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final void m8535() {
        C1325 c1325 = this.f14428;
        synchronized (c1325.f5436) {
            try {
                if (!this.f14429) {
                    c1325.f5435.release();
                    c1325.f5436.notifyAll();
                    if (this == c1325.f5441) {
                        c1325.f5441 = null;
                    } else if (this == c1325.f5440) {
                        c1325.f5440 = null;
                    } else {
                        C1736 c1736 = ((C4205) ((ᵢˇᵭ) c1325).ᵧᵾˀˈ).f15715;
                        C4205.m9132(c1736);
                        c1736.f6937.m6038("Current scheduler thread is neither worker nor network");
                    }
                    this.f14429 = true;
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }
}
