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 // Dart core library. | 5 // Dart core library. |
6 | 6 |
7 /** | 7 /** |
8 * [SendPort]s are created from [ReceivePort]s. Any message sent through | 8 * [SendPort]s are created from [ReceivePort]s. Any message sent through |
9 * a [SendPort] is delivered to its respective [ReceivePort]. There might be | 9 * a [SendPort] is delivered to its respective [ReceivePort]. There might be |
10 * many [SendPort]s for the same [ReceivePort]. | 10 * many [SendPort]s for the same [ReceivePort]. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 /** | 48 /** |
49 * [ReceivePort]s, together with [SendPort]s, are the only means of | 49 * [ReceivePort]s, together with [SendPort]s, are the only means of |
50 * communication between isolates. [ReceivePort]s have a [:toSendPort:] method | 50 * communication between isolates. [ReceivePort]s have a [:toSendPort:] method |
51 * which returns a [SendPort]. Any message that is sent through this [SendPort] | 51 * which returns a [SendPort]. Any message that is sent through this [SendPort] |
52 * is delivered to the [ReceivePort] it has been created from. There, they are | 52 * is delivered to the [ReceivePort] it has been created from. There, they are |
53 * dispatched to the callback that has been registered on the receive port. | 53 * dispatched to the callback that has been registered on the receive port. |
54 * | 54 * |
55 * A [ReceivePort] may have many [SendPort]s. | 55 * A [ReceivePort] may have many [SendPort]s. |
56 */ | 56 */ |
57 interface ReceivePort factory ReceivePortFactory { | 57 interface ReceivePort default ReceivePortFactory { |
58 | 58 |
59 /** | 59 /** |
60 * Opens a long-lived port for receiving messages. The returned port | 60 * Opens a long-lived port for receiving messages. The returned port |
61 * must be explicitly closed through [ReceivePort.close]. | 61 * must be explicitly closed through [ReceivePort.close]. |
62 */ | 62 */ |
63 ReceivePort(); | 63 ReceivePort(); |
64 | 64 |
65 /** | 65 /** |
66 * Opens a single-shot reply port. Once a message has been received | 66 * Opens a single-shot reply port. Once a message has been received |
67 * on this port, it is automatically closed -- obviously without | 67 * on this port, it is automatically closed -- obviously without |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 /** | 171 /** |
172 * When isolates are created, an instance of the template's class is | 172 * When isolates are created, an instance of the template's class is |
173 * instantiated in the new isolate. After the [port] has been set up, this | 173 * instantiated in the new isolate. After the [port] has been set up, this |
174 * [main] method is invoked on the instance. | 174 * [main] method is invoked on the instance. |
175 */ | 175 */ |
176 abstract void main(); | 176 abstract void main(); |
177 | 177 |
178 final bool _isLight; | 178 final bool _isLight; |
179 ReceivePort _port; | 179 ReceivePort _port; |
180 } | 180 } |
OLD | NEW |