- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
77 lines
3.1 KiB
Java
77 lines
3.1 KiB
Java
package kotlinx.coroutines;
|
|
|
|
import java.util.concurrent.locks.LockSupport;
|
|
import kotlin.coroutines.CoroutineContext;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public final class BlockingCoroutine extends AbstractCoroutine {
|
|
public final Thread blockedThread;
|
|
public final EventLoop eventLoop;
|
|
|
|
@Override // kotlinx.coroutines.JobSupport
|
|
public boolean isScopedCoroutine() {
|
|
return true;
|
|
}
|
|
|
|
public BlockingCoroutine(CoroutineContext coroutineContext, Thread thread, EventLoop eventLoop) {
|
|
super(coroutineContext, true, true);
|
|
this.blockedThread = thread;
|
|
this.eventLoop = eventLoop;
|
|
}
|
|
|
|
@Override // kotlinx.coroutines.JobSupport
|
|
public void afterCompletion(Object obj) {
|
|
if (Intrinsics.areEqual(Thread.currentThread(), this.blockedThread)) {
|
|
return;
|
|
}
|
|
Thread thread = this.blockedThread;
|
|
AbstractTimeSourceKt.getTimeSource();
|
|
LockSupport.unpark(thread);
|
|
}
|
|
|
|
public final Object joinBlocking() {
|
|
AbstractTimeSourceKt.getTimeSource();
|
|
try {
|
|
EventLoop eventLoop = this.eventLoop;
|
|
if (eventLoop != null) {
|
|
EventLoop.incrementUseCount$default(eventLoop, false, 1, null);
|
|
}
|
|
while (!Thread.interrupted()) {
|
|
try {
|
|
EventLoop eventLoop2 = this.eventLoop;
|
|
long processNextEvent = eventLoop2 != null ? eventLoop2.processNextEvent() : Long.MAX_VALUE;
|
|
if (!isCompleted()) {
|
|
AbstractTimeSourceKt.getTimeSource();
|
|
LockSupport.parkNanos(this, processNextEvent);
|
|
} else {
|
|
EventLoop eventLoop3 = this.eventLoop;
|
|
if (eventLoop3 != null) {
|
|
EventLoop.decrementUseCount$default(eventLoop3, false, 1, null);
|
|
}
|
|
AbstractTimeSourceKt.getTimeSource();
|
|
Object unboxState = JobSupportKt.unboxState(getState$kotlinx_coroutines_core());
|
|
CompletedExceptionally completedExceptionally = unboxState instanceof CompletedExceptionally ? (CompletedExceptionally) unboxState : null;
|
|
if (completedExceptionally == null) {
|
|
return unboxState;
|
|
}
|
|
throw completedExceptionally.cause;
|
|
}
|
|
} catch (Throwable th) {
|
|
EventLoop eventLoop4 = this.eventLoop;
|
|
if (eventLoop4 != null) {
|
|
EventLoop.decrementUseCount$default(eventLoop4, false, 1, null);
|
|
}
|
|
throw th;
|
|
}
|
|
}
|
|
InterruptedException interruptedException = new InterruptedException();
|
|
cancelCoroutine(interruptedException);
|
|
throw interruptedException;
|
|
} catch (Throwable th2) {
|
|
AbstractTimeSourceKt.getTimeSource();
|
|
throw th2;
|
|
}
|
|
}
|
|
}
|