OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
6 * Concurrent programming using _isolates_: | 6 * Concurrent programming using _isolates_: |
7 * independent workers that are similar to threads | 7 * independent workers that are similar to threads |
8 * but don't share memory, | 8 * but don't share memory, |
9 * communicating only via messages. | 9 * communicating only via messages. |
10 * | 10 * |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 } | 265 } |
266 } | 266 } |
267 | 267 |
268 /** | 268 /** |
269 * Sends messages to its [ReceivePort]s. | 269 * Sends messages to its [ReceivePort]s. |
270 * | 270 * |
271 * [SendPort]s are created from [ReceivePort]s. Any message sent through | 271 * [SendPort]s are created from [ReceivePort]s. Any message sent through |
272 * a [SendPort] is delivered to its corresponding [ReceivePort]. There might be | 272 * a [SendPort] is delivered to its corresponding [ReceivePort]. There might be |
273 * many [SendPort]s for the same [ReceivePort]. | 273 * many [SendPort]s for the same [ReceivePort]. |
274 * | 274 * |
275 * [SendPort]s can be transmitted to other isolates. | 275 * [SendPort]s can be transmitted to other isolates, and they preserve equality |
| 276 * when sent. |
276 */ | 277 */ |
277 abstract class SendPort { | 278 abstract class SendPort implements Capability { |
278 | 279 |
279 /** | 280 /** |
280 * Sends an asynchronous [message] through this send port, to its | 281 * Sends an asynchronous [message] through this send port, to its |
281 * corresponding `ReceivePort`. | 282 * corresponding `ReceivePort`. |
282 * | 283 * |
283 * The content of [message] can be: primitive values (null, num, bool, double, | 284 * The content of [message] can be: primitive values (null, num, bool, double, |
284 * String), instances of [SendPort], and lists and maps whose elements are any | 285 * String), instances of [SendPort], and lists and maps whose elements are any |
285 * of these. List and maps are also allowed to be cyclic. | 286 * of these. List and maps are also allowed to be cyclic. |
286 * | 287 * |
287 * In the special circumstances when two isolates share the same code and are | 288 * In the special circumstances when two isolates share the same code and are |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 const _IsolateUnhandledException(this.message, this.source, this.stackTrace); | 422 const _IsolateUnhandledException(this.message, this.source, this.stackTrace); |
422 | 423 |
423 String toString() { | 424 String toString() { |
424 return 'IsolateUnhandledException: exception while handling message: ' | 425 return 'IsolateUnhandledException: exception while handling message: ' |
425 '${message} \n ' | 426 '${message} \n ' |
426 '${source.toString().replaceAll("\n", "\n ")}\n' | 427 '${source.toString().replaceAll("\n", "\n ")}\n' |
427 'original stack trace:\n ' | 428 'original stack trace:\n ' |
428 '${stackTrace.toString().replaceAll("\n","\n ")}'; | 429 '${stackTrace.toString().replaceAll("\n","\n ")}'; |
429 } | 430 } |
430 } | 431 } |
OLD | NEW |