what-the-bank/sources/o/RunnableC15044gfd.java

162 lines
4.8 KiB
Java

package o;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.LockSupport;
import o.AbstractC15053gfm;
/* renamed from: o.gfd, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class RunnableC15044gfd extends AbstractC15053gfm implements Runnable {
private static volatile Thread _thread;
public static final RunnableC15044gfd a;
private static volatile int debugStatus;
private static final long f;
private RunnableC15044gfd() {
}
static {
Long l;
RunnableC15044gfd runnableC15044gfd = new RunnableC15044gfd();
a = runnableC15044gfd;
runnableC15044gfd.c(false);
TimeUnit timeUnit = TimeUnit.MILLISECONDS;
try {
l = Long.getLong("kotlinx.coroutines.DefaultExecutor.keepAlive", 1000L);
} catch (SecurityException unused) {
l = 1000L;
}
f = timeUnit.toNanos(l.longValue());
}
@Override // o.AbstractC15059gfs
protected final Thread b() {
Thread thread = _thread;
return thread == null ? k() : thread;
}
@Override // o.AbstractC15053gfm, o.AbstractC15057gfq
public final void e() {
debugStatus = 4;
super.e();
}
@Override // java.lang.Runnable
public final void run() {
boolean i;
Thread thread;
C15039gfT c15039gfT = C15039gfT.e;
C15039gfT.a(this);
try {
if (!o()) {
if (i) {
return;
}
if (thread == null) {
return;
} else {
return;
}
}
long j = Long.MAX_VALUE;
while (true) {
Thread.interrupted();
long j2 = j();
if (j2 == Long.MAX_VALUE) {
long nanoTime = System.nanoTime();
if (j == Long.MAX_VALUE) {
j = f + nanoTime;
}
long j3 = j - nanoTime;
if (j3 <= 0) {
_thread = null;
n();
if (i() || _thread != null) {
return;
}
k();
return;
}
if (j2 > j3) {
j2 = j3;
}
} else {
j = Long.MAX_VALUE;
}
if (j2 > 0) {
int i2 = debugStatus;
if (i2 == 2 || i2 == 3) {
break;
} else {
LockSupport.parkNanos(this, j2);
}
}
}
_thread = null;
n();
if (i() || _thread != null) {
return;
}
k();
} finally {
_thread = null;
n();
if (!i() && _thread == null) {
k();
}
}
}
private final Thread k() {
Thread thread;
synchronized (this) {
thread = _thread;
if (thread == null) {
thread = new Thread(this, "o.gfd");
_thread = thread;
thread.setDaemon(true);
thread.start();
}
}
return thread;
}
private final void n() {
synchronized (this) {
int i = debugStatus;
if (i == 2 || i == 3) {
debugStatus = 3;
g();
notifyAll();
}
}
}
private final boolean o() {
synchronized (this) {
int i = debugStatus;
if (i == 2 || i == 3) {
return false;
}
debugStatus = 1;
notifyAll();
return true;
}
}
@Override // o.AbstractC15053gfm
public final void e(Runnable runnable) {
if (debugStatus != 4) {
super.e(runnable);
return;
}
throw new RejectedExecutionException("DefaultExecutor was shut down. This error indicates that Dispatchers.shutdown() was invoked prior to completion of exiting coroutines, leaving coroutines in incomplete state. Please refer to Dispatchers.shutdown documentation for more details");
}
@Override // o.AbstractC15059gfs
protected final void e(long j, AbstractC15053gfm.HBt hBt) {
throw new RejectedExecutionException("DefaultExecutor was shut down. This error indicates that Dispatchers.shutdown() was invoked prior to completion of exiting coroutines, leaving coroutines in incomplete state. Please refer to Dispatchers.shutdown documentation for more details");
}
}