Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1410)

Unified Diff: runtime/tests/vm/dart/spawn_shutdown_test.dart

Issue 1560853002: Fix Shutdown race. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/isolate.cc ('k') | runtime/tests/vm/vm.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/tests/vm/dart/spawn_shutdown_test.dart
diff --git a/runtime/tests/vm/dart/spawn_shutdown_test.dart b/runtime/tests/vm/dart/spawn_shutdown_test.dart
index 238c3259eb6650d92d5b30234c492a3184f8b6ce..13fb2b8e211630c7e2c120d0131e60e2dc466e8c 100644
--- a/runtime/tests/vm/dart/spawn_shutdown_test.dart
+++ b/runtime/tests/vm/dart/spawn_shutdown_test.dart
@@ -14,6 +14,15 @@ import 'dart:isolate';
// workers in a staggered fashion in an attempt to see a variety of
// isolate states at the time that this program terminates.
+trySpawn(Function f, Object o) async {
+ try {
+ await Isolate.spawn(f, o);
+ } catch (e) {
+ // Isolate spawning may fail if the program is ending.
+ assert(e is IsolateSpawnException);
+ }
+}
+
void worker(SendPort parentPort) {
var port = new RawReceivePort();
@@ -26,7 +35,7 @@ void worker(SendPort parentPort) {
}
// Spawn a child worker.
- Isolate.spawn(worker, port.sendPort);
+ trySpawn(worker, port.sendPort);
}
void main() {
@@ -39,7 +48,7 @@ void main() {
// variety of states when the vm shuts down.
print('Starting ${numWorkers} workers...');
for (int i = 0; i < numWorkers; i++) {
- Isolate.spawn(worker, null);
+ trySpawn(worker, null);
sleep(delay);
}
« no previous file with comments | « runtime/lib/isolate.cc ('k') | runtime/tests/vm/vm.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698