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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 * | 478 * |
479 * The content of [message] can be: primitive values (null, num, bool, double, | 479 * The content of [message] can be: primitive values (null, num, bool, double, |
480 * String), instances of [SendPort], and lists and maps whose elements are any | 480 * String), instances of [SendPort], and lists and maps whose elements are any |
481 * of these. List and maps are also allowed to be cyclic. | 481 * of these. List and maps are also allowed to be cyclic. |
482 * | 482 * |
483 * In the special circumstances when two isolates share the same code and are | 483 * In the special circumstances when two isolates share the same code and are |
484 * running in the same process (e.g. isolates created via [Isolate.spawn]), it | 484 * running in the same process (e.g. isolates created via [Isolate.spawn]), it |
485 * is also possible to send object instances (which would be copied in the | 485 * is also possible to send object instances (which would be copied in the |
486 * process). This is currently only supported by the dartvm. For now, the | 486 * process). This is currently only supported by the dartvm. For now, the |
487 * dart2js compiler only supports the restricted messages described above. | 487 * dart2js compiler only supports the restricted messages described above. |
| 488 * |
| 489 * The send happens immediately and doesn't block. The corresponding receive |
| 490 * port can receive the message as soon as its isolate's event loop is ready |
| 491 * to deliver it, independently of what the sending isolate is doing. |
488 */ | 492 */ |
489 void send(var message); | 493 void send(var message); |
490 | 494 |
491 /** | 495 /** |
492 * Tests whether [other] is a [SendPort] pointing to the same | 496 * Tests whether [other] is a [SendPort] pointing to the same |
493 * [ReceivePort] as this one. | 497 * [ReceivePort] as this one. |
494 */ | 498 */ |
495 bool operator==(var other); | 499 bool operator==(var other); |
496 | 500 |
497 /** | 501 /** |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 * as the original error, but has no other features of the original error. | 636 * as the original error, but has no other features of the original error. |
633 */ | 637 */ |
634 class RemoteError implements Error { | 638 class RemoteError implements Error { |
635 final String _description; | 639 final String _description; |
636 final StackTrace stackTrace; | 640 final StackTrace stackTrace; |
637 RemoteError(String description, String stackDescription) | 641 RemoteError(String description, String stackDescription) |
638 : _description = description, | 642 : _description = description, |
639 stackTrace = new StackTrace.fromString(stackDescription); | 643 stackTrace = new StackTrace.fromString(stackDescription); |
640 String toString() => _description; | 644 String toString() => _description; |
641 } | 645 } |
OLD | NEW |