| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library test; |
| 6 |
| 5 import 'dart:async'; | 7 import 'dart:async'; |
| 6 import 'dart:isolate'; | 8 import 'dart:isolate'; |
| 7 | 9 |
| 8 runTest() { | 10 runTest() { |
| 9 SendPort mainIsolate; | 11 SendPort mainIsolate; |
| 10 bool isFirst = true; | 12 bool isFirst = true; |
| 11 port.receive((msg, replyTo) { | 13 port.receive((msg, replyTo) { |
| 12 if (isFirst) { | 14 if (isFirst) { |
| 13 mainIsolate = msg; | 15 mainIsolate = msg; |
| 14 isFirst = false; | 16 isFirst = false; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 30 var port = new ReceivePort(); | 32 var port = new ReceivePort(); |
| 31 SendPort otherIsolate = spawnFunction(runTest, globalErrorHandler); | 33 SendPort otherIsolate = spawnFunction(runTest, globalErrorHandler); |
| 32 otherIsolate.send(port.toSendPort()); | 34 otherIsolate.send(port.toSendPort()); |
| 33 otherIsolate.send("message 2"); | 35 otherIsolate.send("message 2"); |
| 34 port.receive((msg, replyPort) { | 36 port.receive((msg, replyPort) { |
| 35 Expect.equals("received", msg); | 37 Expect.equals("received", msg); |
| 36 port.close(); | 38 port.close(); |
| 37 timer.cancel(); | 39 timer.cancel(); |
| 38 }); | 40 }); |
| 39 } | 41 } |
| OLD | NEW |