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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 * untrustedCode(restrictedIsolate); | 130 * untrustedCode(restrictedIsolate); |
131 * ``` | 131 * ``` |
132 * This example creates a new `Isolate` object that cannot be used to | 132 * This example creates a new `Isolate` object that cannot be used to |
133 * pause or terminate the isolate. All the untrusted code can do is to | 133 * pause or terminate the isolate. All the untrusted code can do is to |
134 * inspect the isolate and see uncaught errors or when it terminates. | 134 * inspect the isolate and see uncaught errors or when it terminates. |
135 */ | 135 */ |
136 Isolate(this.controlPort, {this.pauseCapability, | 136 Isolate(this.controlPort, {this.pauseCapability, |
137 this.terminateCapability}); | 137 this.terminateCapability}); |
138 | 138 |
139 /** | 139 /** |
140 * Return the current [Isolate]. | 140 * Return an [Isolate] object representing the current isolate. |
141 * | 141 * |
142 * The isolate gives access to the capabilities needed to inspect, | 142 * The current isolate for code using [current] |
| 143 * is the isolate running the code. |
| 144 * |
| 145 * The isolate object provides the capabilities required to inspect, |
143 * pause or kill the isolate, and allows granting these capabilities | 146 * pause or kill the isolate, and allows granting these capabilities |
144 * to others. | 147 * to others. |
| 148 * |
| 149 * It is possible to pause the current isolate, but doing so *without* |
| 150 * first passing the ability to resume it again to another isolate, |
| 151 * is a sure way to hang your program. |
145 */ | 152 */ |
146 external static Isolate get current; | 153 external static Isolate get current; |
147 | 154 |
148 /** | 155 /** |
149 * Returns the package root of the current isolate, if any. | 156 * Returns the package root of the current isolate, if any. |
150 * | 157 * |
151 * If the isolate is using a [packageConfig] or the isolate has not been | 158 * If the isolate is using a [packageConfig] or the isolate has not been |
152 * setup for package resolution, this getter returns `null`, otherwise it | 159 * setup for package resolution, this getter returns `null`, otherwise it |
153 * returns the package root - a directory that package URIs are resolved | 160 * returns the package root - a directory that package URIs are resolved |
154 * against. | 161 * against. |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 * as the original error, but has no other features of the original error. | 704 * as the original error, but has no other features of the original error. |
698 */ | 705 */ |
699 class RemoteError implements Error { | 706 class RemoteError implements Error { |
700 final String _description; | 707 final String _description; |
701 final StackTrace stackTrace; | 708 final StackTrace stackTrace; |
702 RemoteError(String description, String stackDescription) | 709 RemoteError(String description, String stackDescription) |
703 : _description = description, | 710 : _description = description, |
704 stackTrace = new StackTrace.fromString(stackDescription); | 711 stackTrace = new StackTrace.fromString(stackDescription); |
705 String toString() => _description; | 712 String toString() => _description; |
706 } | 713 } |
OLD | NEW |