OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 import "dart:isolate"; | 5 import "dart:isolate"; |
6 import "dart:async"; | 6 import "dart:async"; |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 import "package:async_helper/async_helper.dart"; | 8 import "package:async_helper/async_helper.dart"; |
9 | 9 |
10 isomain1(replyPort) { | 10 isomain1(replyPort) { |
(...skipping 30 matching lines...) Expand all Loading... |
41 }; | 41 }; |
42 echoPort.send(4); | 42 echoPort.send(4); |
43 SendPort createPingPort(message) { | 43 SendPort createPingPort(message) { |
44 var pingPort = new RawReceivePort(); | 44 var pingPort = new RawReceivePort(); |
45 pingPort.handler = (_) { | 45 pingPort.handler = (_) { |
46 result.add(message); | 46 result.add(message); |
47 pingPort.close(); | 47 pingPort.close(); |
48 }; | 48 }; |
49 return pingPort.sendPort; | 49 return pingPort.sendPort; |
50 } | 50 } |
51 isolate.ping(createPingPort("alive"), Isolate.PING_ALIVE); | 51 isolate.ping(createPingPort("alive"), Isolate.OUT_OF_BAND); |
52 echoPort.send(3); | 52 echoPort.send(3); |
53 isolate.ping(createPingPort("control"), Isolate.PING_CONTROL); | 53 isolate.ping(createPingPort("control"), Isolate.BEFORE_NEXT_EVENT); |
54 echoPort.send(2); | 54 echoPort.send(2); |
55 isolate.ping(createPingPort("event"), Isolate.PING_EVENT); | 55 isolate.ping(createPingPort("event"), Isolate.AS_EVENT); |
56 echoPort.send(1); | 56 echoPort.send(1); |
57 echoPort.send(0); | 57 echoPort.send(0); |
58 }); | 58 }); |
59 }); | 59 }); |
60 } | 60 } |
OLD | NEW |