discord-jadx/app/src/main/java/c/i/a/f/i/b/v4.java

89 lines
2.8 KiB
Java

package c.i.a.f.i.b;
import android.os.Process;
import androidx.annotation.GuardedBy;
import java.util.Objects;
import java.util.concurrent.BlockingQueue;
/* compiled from: com.google.android.gms:play-services-measurement-impl@@18.0.0 */
public final class v4 extends Thread {
public final Object i;
public final BlockingQueue<s4<?>> j;
@GuardedBy("threadLifeCycleLock")
public boolean k = false;
public final /* synthetic */ r4 l;
public v4(r4 r4Var, String str, BlockingQueue<s4<?>> blockingQueue) {
this.l = r4Var;
Objects.requireNonNull(blockingQueue, "null reference");
this.i = new Object();
this.j = blockingQueue;
setName(str);
}
public final void a(InterruptedException interruptedException) {
this.l.g().i.b(String.valueOf(getName()).concat(" was interrupted"), interruptedException);
}
public final void b() {
synchronized (this.l.j) {
if (!this.k) {
this.l.k.release();
this.l.j.notifyAll();
r4 r4Var = this.l;
if (this == r4Var.d) {
r4Var.d = null;
} else if (this == r4Var.e) {
r4Var.e = null;
} else {
r4Var.g().f.a("Current scheduler thread is neither worker nor network");
}
this.k = true;
}
}
}
@Override // java.lang.Thread, java.lang.Runnable
public final void run() {
boolean z2 = false;
while (!z2) {
try {
this.l.k.acquire();
z2 = true;
} catch (InterruptedException e) {
a(e);
}
}
try {
int threadPriority = Process.getThreadPriority(Process.myTid());
while (true) {
s4<?> poll = this.j.poll();
if (poll != null) {
Process.setThreadPriority(poll.j ? threadPriority : 10);
poll.run();
} else {
synchronized (this.i) {
if (this.j.peek() == null) {
Objects.requireNonNull(this.l);
try {
this.i.wait(30000);
} catch (InterruptedException e2) {
a(e2);
}
}
}
synchronized (this.l.j) {
if (this.j.peek() == null) {
if (this.l.a.h.o(p.r0)) {
}
b();
return;
}
}
}
}
} finally {
b();
}
}
}