Always wait for latch before using background handler.

This commit is contained in:
akwizgran
2016-09-19 10:46:25 +01:00
parent bf023874f0
commit f3ea731565

View File

@@ -39,10 +39,11 @@ class AndroidExecutorImpl implements AndroidExecutor {
}
private void startIfNecessary() {
if (started.getAndSet(true)) return;
Thread t = new Thread(loop, "AndroidExecutor");
t.setDaemon(true);
t.start();
if (!started.getAndSet(true)) {
Thread t = new Thread(loop, "AndroidExecutor");
t.setDaemon(true);
t.start();
}
try {
startLatch.await();
} catch (InterruptedException e) {