Don't block waiting for UI thread to be ready

Reviewed By: astreet

Differential Revision: D3323227

fbshipit-source-id: bc8a815f9dca43c8c1adebc7b2554f931f135f33
This commit is contained in:
Alexander Blom 2016-05-23 09:15:45 -07:00 committed by Facebook Github Bot 3
parent d9737571c4
commit 81e4b4202a
1 changed files with 0 additions and 4 deletions

View File

@ -147,20 +147,16 @@ public class MessageQueueThreadImpl implements MessageQueueThread {
final MessageQueueThreadImpl mqt =
new MessageQueueThreadImpl(name, mainLooper, exceptionHandler);
// Ensure that the MQT is registered by the time this method returns
if (UiThreadUtil.isOnUiThread()) {
MessageQueueThreadRegistry.register(mqt);
} else {
final SimpleSettableFuture<Void> registrationFuture = new SimpleSettableFuture<>();
UiThreadUtil.runOnUiThread(
new Runnable() {
@Override
public void run() {
MessageQueueThreadRegistry.register(mqt);
registrationFuture.set(null);
}
});
registrationFuture.getOrThrow();
}
return mqt;
}