Chromium Code Reviews| Index: tests/isolate/src/APIv2_spawnStandaloneTest.dart |
| diff --git a/tests/isolate/src/APIv2_spawnStandaloneTest.dart b/tests/isolate/src/APIv2_spawnStandaloneTest.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b2de7e0b7427b17c68a90f106200c0de6d4b272d |
| --- /dev/null |
| +++ b/tests/isolate/src/APIv2_spawnStandaloneTest.dart |
| @@ -0,0 +1,21 @@ |
| +// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
|
eub
2012/02/10 22:46:19
Update yer boilerplate. :)
|
| +// 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. |
| + |
| +// example of spawning an isolate from a closure |
| +#library('spawn_tests'); |
| + |
| +child(ReceivePort port) { |
| + port.receive((msg, reply) => reply.send("re: $msg")); |
| +} |
| + |
| +main() { |
| + ReceivePort port = new ReceivePort(); |
| + port.receive((msg, _) { |
| + Expect.equals("re: hi", msg); |
| + port.close(); |
| + }); |
| + |
| + Isolate2 c = new Isolate2.fromCode(child); |
| + c.sendPort.send("hi", port.toSendPort()); |
| +} |