fix a race condition with isolate notification (#4286)
* fix a race condition with isolate notification * return a future
This commit is contained in:
parent
2a2bd7b6f4
commit
9e9dfc3d2d
@ -394,10 +394,10 @@ class _RunAndStayResident {
|
||||
observatory = await Observatory.connect(result.observatoryPort);
|
||||
printTrace('Connected to observatory port: ${result.observatoryPort}.');
|
||||
|
||||
observatory.populateIsolateInfo();
|
||||
observatory.onExtensionEvent.listen((Event event) {
|
||||
printTrace(event.toString());
|
||||
});
|
||||
|
||||
observatory.onIsolateEvent.listen((Event event) {
|
||||
printTrace(event.toString());
|
||||
});
|
||||
|
@ -74,6 +74,11 @@ class Observatory {
|
||||
_getEventController(data['streamId']).add(event);
|
||||
}
|
||||
|
||||
Future<Null> populateIsolateInfo() async {
|
||||
// Calling this has the side effect of populating the isolate information.
|
||||
await waitFirstIsolate;
|
||||
}
|
||||
|
||||
Future<IsolateRef> get waitFirstIsolate async {
|
||||
if (isolates.isNotEmpty)
|
||||
return isolates.first;
|
||||
|
Loading…
x
Reference in New Issue
Block a user