3ea5e13ad7
The only fix needed for relanding is adding _ensureScheduleImmediate to the list of vm entrypoints in //runtime/vm/compiler/aot/precompiler.cc Original commit message: Adds a top-level call waitForEventSync to dart:io that blocks the thread an Isolate is running on until messages are available. Before the thread blocks, the microtask queue is drained. Before waitForEventSync returns, all messages are handled. Lifting this up from a comment: This is apropos of the request that nweiz@ sent to the mailing list a couple weeks back. I'm not sure we should land this. We certainly shouldn't land it without some annotations that will make the analyzer complain a lot in most configurations, but I don't know what those annotations are. fixes #31102 Change-Id: Id96de46cc5f10e1847045cfafb7cfed6a38bce16 Reviewed-on: https://dart-review.googlesource.com/28920 Reviewed-by: Siva Annamalai <asiva@google.com> Commit-Queue: Zach Anderson <zra@google.com>
31 lines
841 B
Dart
31 lines
841 B
Dart
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
// part of "async_patch.dart";
|
|
|
|
@patch
|
|
class _AsyncRun {
|
|
@patch
|
|
static void _scheduleImmediate(void callback()) {
|
|
if (_ScheduleImmediate._closure == null) {
|
|
throw new UnsupportedError("Microtasks are not supported");
|
|
}
|
|
_ScheduleImmediate._closure(callback);
|
|
}
|
|
}
|
|
|
|
typedef void _ScheduleImmediateClosure(void callback());
|
|
|
|
class _ScheduleImmediate {
|
|
static _ScheduleImmediateClosure _closure;
|
|
}
|
|
|
|
void _setScheduleImmediateClosure(_ScheduleImmediateClosure closure) {
|
|
_ScheduleImmediate._closure = closure;
|
|
}
|
|
|
|
void _ensureScheduleImmediate() {
|
|
_AsyncRun._scheduleImmediate(_startMicrotaskLoop);
|
|
}
|