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 class IsolateSpawnException implements Exception { | 5 class IsolateSpawnException implements Exception { |
6 const IsolateSpawnException(String this._s); | 6 const IsolateSpawnException(String this._s); |
7 String toString() => "IsolateSpawnException: '$_s'"; | 7 String toString() => "IsolateSpawnException: '$_s'"; |
8 final String _s; | 8 final String _s; |
9 } | 9 } |
10 | 10 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 * message to this send port with replyTo set to such receive port, and, when | 83 * message to this send port with replyTo set to such receive port, and, when |
84 * a reply is received, it closes the receive port and completes the returned | 84 * a reply is received, it closes the receive port and completes the returned |
85 * future. | 85 * future. |
86 */ | 86 */ |
87 Future call(var message); | 87 Future call(var message); |
88 | 88 |
89 /** | 89 /** |
90 * Tests whether [other] is a [SendPort] pointing to the same | 90 * Tests whether [other] is a [SendPort] pointing to the same |
91 * [ReceivePort] as this one. | 91 * [ReceivePort] as this one. |
92 */ | 92 */ |
93 bool operator==(var other); | 93 bool operator==(var other); |
94 | 94 |
95 /** | 95 /** |
96 * Returns an immutable hash code for this send port that is | 96 * Returns an immutable hash code for this send port that is |
97 * consistent with the == operator. | 97 * consistent with the == operator. |
98 */ | 98 */ |
99 int hashCode(); | 99 int hashCode(); |
100 | 100 |
101 } | 101 } |
102 | 102 |
103 /** | 103 /** |
(...skipping 29 matching lines...) Expand all Loading... |
133 void close(); | 133 void close(); |
134 | 134 |
135 /** | 135 /** |
136 * Creates a new send port that sends to this receive port. It is legal to | 136 * Creates a new send port that sends to this receive port. It is legal to |
137 * create several [SendPort]s from the same [ReceivePort]. | 137 * create several [SendPort]s from the same [ReceivePort]. |
138 */ | 138 */ |
139 SendPort toSendPort(); | 139 SendPort toSendPort(); |
140 | 140 |
141 } | 141 } |
142 | 142 |
| 143 // TODO(kasperl): Make this hashable and document it. |
| 144 interface SendPortSync { |
| 145 |
| 146 callSync(var message); |
| 147 |
| 148 } |
| 149 |
143 /** | 150 /** |
144 * NOTE: This API will be deprecated soon. | 151 * NOTE: This API will be deprecated soon. |
145 * | 152 * |
146 * The [Isolate] class serves two purposes: (1) as template for spawning a new | 153 * The [Isolate] class serves two purposes: (1) as template for spawning a new |
147 * isolate, and (2) as entry-point for the newly spawned isolate. | 154 * isolate, and (2) as entry-point for the newly spawned isolate. |
148 * | 155 * |
149 * New isolates are spawned by sub-classing [Isolate] and then invoking | 156 * New isolates are spawned by sub-classing [Isolate] and then invoking |
150 * [:spawn:] on the instance. This will spawn a new isolate, which creates a | 157 * [:spawn:] on the instance. This will spawn a new isolate, which creates a |
151 * new instance of the class, initializes the instance's [port] field | 158 * new instance of the class, initializes the instance's [port] field |
152 * and invokes the instance method [main]. | 159 * and invokes the instance method [main]. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 /** | 234 /** |
228 * When isolates are created, an instance of the template's class is | 235 * When isolates are created, an instance of the template's class is |
229 * instantiated in the new isolate. After the [port] has been set up, this | 236 * instantiated in the new isolate. After the [port] has been set up, this |
230 * [main] method is invoked on the instance. | 237 * [main] method is invoked on the instance. |
231 */ | 238 */ |
232 abstract void main(); | 239 abstract void main(); |
233 | 240 |
234 final bool _isLight; | 241 final bool _isLight; |
235 ReceivePort _port; | 242 ReceivePort _port; |
236 } | 243 } |
OLD | NEW |