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 part of dart.isolate; | 5 part of dart.isolate; |
6 | 6 |
7 /** | 7 /** |
8 * The initial [IsolateStream] available by default for this isolate. This | 8 * The initial [IsolateStream] available by default for this isolate. This |
9 * [IsolateStream] is created automatically and it is commonly used to establish | 9 * [IsolateStream] is created automatically and it is commonly used to establish |
10 * the first communication between isolates (see [streamSpawnFunction] and | 10 * the first communication between isolates (see [streamSpawnFunction] and |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 if (!_isClosed) { | 72 if (!_isClosed) { |
73 _isClosed = true; | 73 _isClosed = true; |
74 _port.close(); | 74 _port.close(); |
75 _controller.close(); | 75 _controller.close(); |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 StreamSubscription listen(void onData(event), | 79 StreamSubscription listen(void onData(event), |
80 { void onError(AsyncError error), | 80 { void onError(AsyncError error), |
81 void onDone(), | 81 void onDone(), |
82 bool unsubscribeOnError}) { | 82 bool cancelOnError}) { |
83 return _controller.stream.listen(onData, | 83 return _controller.stream.listen(onData, |
84 onError: onError, | 84 onError: onError, |
85 onDone: onDone, | 85 onDone: onDone, |
86 unsubscribeOnError: unsubscribeOnError); | 86 cancelOnError: cancelOnError); |
87 } | 87 } |
88 } | 88 } |
89 | 89 |
90 /** | 90 /** |
91 * [IsolateSink]s represent the feed for [IsolateStream]s. Any message written | 91 * [IsolateSink]s represent the feed for [IsolateStream]s. Any message written |
92 * to [this] is delivered to its respective [IsolateStream]. [IsolateSink]s are | 92 * to [this] is delivered to its respective [IsolateStream]. [IsolateSink]s are |
93 * created by [MessageBox]es. | 93 * created by [MessageBox]es. |
94 * | 94 * |
95 * [IsolateSink]s can be transmitted to other isolates. | 95 * [IsolateSink]s can be transmitted to other isolates. |
96 */ | 96 */ |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 * default stream. | 141 * default stream. |
142 * | 142 * |
143 * The optional [unhandledExceptionCallback] argument is invoked whenever an | 143 * The optional [unhandledExceptionCallback] argument is invoked whenever an |
144 * exception inside the isolate is unhandled. It can be seen as a big | 144 * exception inside the isolate is unhandled. It can be seen as a big |
145 * `try/catch` around everything that is executed inside the isolate. The | 145 * `try/catch` around everything that is executed inside the isolate. The |
146 * callback should return `true` when it was able to handled the exception. | 146 * callback should return `true` when it was able to handled the exception. |
147 */ | 147 */ |
148 external IsolateSink streamSpawnFunction( | 148 external IsolateSink streamSpawnFunction( |
149 void topLevelFunction(), | 149 void topLevelFunction(), |
150 [bool unhandledExceptionCallback(IsolateUnhandledException e)]); | 150 [bool unhandledExceptionCallback(IsolateUnhandledException e)]); |
OLD | NEW |