OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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("MandelIsolateTest"); | 5 #library("MandelIsolateTest"); |
6 #import('TestFramework.dart'); | 6 #import('TestFramework.dart'); |
7 | 7 |
8 final TERMINATION_MESSAGE = -1; | 8 final TERMINATION_MESSAGE = -1; |
9 final N = 100; | 9 final N = 100; |
10 final ISOLATES = 20; | 10 final ISOLATES = 20; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 94 } |
95 | 95 |
96 void shutdown() { | 96 void shutdown() { |
97 _out.then((SendPort p) { | 97 _out.then((SendPort p) { |
98 p.send(TERMINATION_MESSAGE, null); | 98 p.send(TERMINATION_MESSAGE, null); |
99 }); | 99 }); |
100 } | 100 } |
101 | 101 |
102 MandelbrotState _state; | 102 MandelbrotState _state; |
103 int _id; | 103 int _id; |
104 Promise<SendPort> _out; | 104 Future<SendPort> _out; |
105 | 105 |
106 } | 106 } |
107 | 107 |
108 | 108 |
109 class LineProcessor extends Isolate { | 109 class LineProcessor extends Isolate { |
110 | 110 |
111 LineProcessor() : super() { } | 111 LineProcessor() : super() { } |
112 | 112 |
113 void main() { | 113 void main() { |
114 this.port.receive((message, SendPort replyTo) { | 114 this.port.receive((message, SendPort replyTo) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 result[x] = i; | 146 result[x] = i; |
147 } | 147 } |
148 return result; | 148 return result; |
149 } | 149 } |
150 | 150 |
151 } | 151 } |
152 | 152 |
153 main() { | 153 main() { |
154 runTests([test]); | 154 runTests([test]); |
155 } | 155 } |
OLD | NEW |