| 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
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..794e7375220efc814db156f99fd7fc42d3873f93
|
| --- /dev/null
|
| +++ b/runtime/tests/vm/dart/spawn_shutdown_test.dart
|
| @@ -0,0 +1,32 @@
|
| +// Copyright (c) 2015, 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.
|
| +
|
| +import 'dart:async';
|
| +import 'dart:isolate';
|
| +
|
| +// Spawn an isolate |foo| that will continue trying to spawn isolates even after
|
| +// the timer in |main| completes. This test ensures that the VM can shutdown
|
| +// correctly even while an isolate is attempting to spawn more isolates.
|
| +
|
| +isolate1(sendPort) {
|
| + var receivePort = new ReceivePort();
|
| + sendPort.send(receivePort.sendPort);
|
| + receivePort.listen((msg) {});
|
| +}
|
| +
|
| +void foo(_) {
|
| + while (true) {
|
| + var receivePort = new ReceivePort();
|
| + Isolate.spawn(isolate1, receivePort.sendPort);
|
| + receivePort.listen((sendPort) {
|
| + Isolate.spawn(isolate1,sendPort);
|
| + receivePort.close();
|
| + });
|
| + }
|
| +}
|
| +
|
| +void main() {
|
| + Isolate.spawn(foo, null);
|
| + new Timer(const Duration(seconds: 10), () {});
|
| +}
|
|
|