Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: sdk/lib/isolate/isolate.dart

Issue 163523003: Add 'startPaused' option to Isolate.spawn*. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/_internal/lib/isolate_patch.dart ('k') | tests/isolate/isolate.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 * It is not allowed to pass the value of function expressions or an instance 51 * It is not allowed to pass the value of function expressions or an instance
52 * method extracted from an object. 52 * method extracted from an object.
53 * 53 *
54 * The entry-point function is invoked with the initial [message]. 54 * The entry-point function is invoked with the initial [message].
55 * Usually the initial [message] contains a [SendPort] so 55 * Usually the initial [message] contains a [SendPort] so
56 * that the spawner and spawnee can communicate with each other. 56 * that the spawner and spawnee can communicate with each other.
57 * 57 *
58 * Returns a future that will complete with an [Isolate] instance if the 58 * Returns a future that will complete with an [Isolate] instance if the
59 * spawning succeeded. It will complete with an error otherwise. 59 * spawning succeeded. It will complete with an error otherwise.
60 */ 60 */
61 external static Future<Isolate> spawn(void entryPoint(message), var message); 61 external static Future<Isolate> spawn(void entryPoint(message), var message,
62 { bool paused: false });
62 63
63 /** 64 /**
64 * Creates and spawns an isolate that runs the code from the library with 65 * Creates and spawns an isolate that runs the code from the library with
65 * the specified URI. 66 * the specified URI.
66 * 67 *
67 * The isolate starts executing the top-level `main` function of the library 68 * The isolate starts executing the top-level `main` function of the library
68 * with the given URI. 69 * with the given URI.
69 * 70 *
70 * The target `main` must be a subtype of one of these three signatures: 71 * The target `main` must be a subtype of one of these three signatures:
71 * 72 *
72 * * `main()` 73 * * `main()`
73 * * `main(args)` 74 * * `main(args)`
74 * * `main(args, message)` 75 * * `main(args, message)`
75 * 76 *
76 * When present, the parameter `args` is set to the provided [args] list. 77 * When present, the parameter `args` is set to the provided [args] list.
77 * When present, the parameter `message` is set to the initial [message]. 78 * When present, the parameter `message` is set to the initial [message].
78 * 79 *
79 * Returns a future that will complete with an [Isolate] instance if the 80 * Returns a future that will complete with an [Isolate] instance if the
80 * spawning succeeded. It will complete with an error otherwise. 81 * spawning succeeded. It will complete with an error otherwise.
81 */ 82 */
82 external static Future<Isolate> spawnUri( 83 external static Future<Isolate> spawnUri(
83 Uri uri, List<String> args, var message); 84 Uri uri, List<String> args, var message, { bool paused: false });
84 85
85 86
86 /** 87 /**
87 * Requests the isolate to pause. 88 * Requests the isolate to pause.
88 * 89 *
89 * The isolate should stop handling events by pausing its event queue. 90 * The isolate should stop handling events by pausing its event queue.
90 * The request will eventually make the isolate stop doing anything. 91 * The request will eventually make the isolate stop doing anything.
91 * It will be handled before any other messages sent to the isolate from 92 * It will be handled before any other messages sent to the isolate from
92 * the current isolate, but no other guarantees are provided. 93 * the current isolate, but no other guarantees are provided.
93 * 94 *
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 const _IsolateUnhandledException(this.message, this.source, this.stackTrace); 291 const _IsolateUnhandledException(this.message, this.source, this.stackTrace);
291 292
292 String toString() { 293 String toString() {
293 return 'IsolateUnhandledException: exception while handling message: ' 294 return 'IsolateUnhandledException: exception while handling message: '
294 '${message} \n ' 295 '${message} \n '
295 '${source.toString().replaceAll("\n", "\n ")}\n' 296 '${source.toString().replaceAll("\n", "\n ")}\n'
296 'original stack trace:\n ' 297 'original stack trace:\n '
297 '${stackTrace.toString().replaceAll("\n","\n ")}'; 298 '${stackTrace.toString().replaceAll("\n","\n ")}';
298 } 299 }
299 } 300 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/lib/isolate_patch.dart ('k') | tests/isolate/isolate.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698