mirror of
https://github.com/status-im/react-native.git
synced 2025-01-16 12:34:17 +00:00
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:
parent
d9737571c4
commit
81e4b4202a
@ -147,20 +147,16 @@ public class MessageQueueThreadImpl implements MessageQueueThread {
|
|||||||
final MessageQueueThreadImpl mqt =
|
final MessageQueueThreadImpl mqt =
|
||||||
new MessageQueueThreadImpl(name, mainLooper, exceptionHandler);
|
new MessageQueueThreadImpl(name, mainLooper, exceptionHandler);
|
||||||
|
|
||||||
// Ensure that the MQT is registered by the time this method returns
|
|
||||||
if (UiThreadUtil.isOnUiThread()) {
|
if (UiThreadUtil.isOnUiThread()) {
|
||||||
MessageQueueThreadRegistry.register(mqt);
|
MessageQueueThreadRegistry.register(mqt);
|
||||||
} else {
|
} else {
|
||||||
final SimpleSettableFuture<Void> registrationFuture = new SimpleSettableFuture<>();
|
|
||||||
UiThreadUtil.runOnUiThread(
|
UiThreadUtil.runOnUiThread(
|
||||||
new Runnable() {
|
new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MessageQueueThreadRegistry.register(mqt);
|
MessageQueueThreadRegistry.register(mqt);
|
||||||
registrationFuture.set(null);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registrationFuture.getOrThrow();
|
|
||||||
}
|
}
|
||||||
return mqt;
|
return mqt;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user