32 lines
1.1 KiB
Java
32 lines
1.1 KiB
Java
package io.reactivex.internal.util;
|
|
|
|
import io.reactivex.disposables.Disposable;
|
|
import io.reactivex.internal.schedulers.NonBlockingThread;
|
|
import io.reactivex.plugins.RxJavaPlugins;
|
|
import java.util.concurrent.CountDownLatch;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class BlockingHelper {
|
|
public static void a(CountDownLatch countDownLatch, Disposable disposable) {
|
|
if (countDownLatch.getCount() == 0) {
|
|
return;
|
|
}
|
|
try {
|
|
a();
|
|
countDownLatch.await();
|
|
} catch (InterruptedException e) {
|
|
disposable.dispose();
|
|
Thread.currentThread().interrupt();
|
|
throw new IllegalStateException("Interrupted while waiting for subscription to complete.", e);
|
|
}
|
|
}
|
|
|
|
public static void a() {
|
|
if (RxJavaPlugins.a()) {
|
|
if ((Thread.currentThread() instanceof NonBlockingThread) || RxJavaPlugins.b()) {
|
|
throw new IllegalStateException("Attempt to block on a Scheduler " + Thread.currentThread().getName() + " that doesn't support blocking operators as they may lead to deadlock");
|
|
}
|
|
}
|
|
}
|
|
}
|