Skip to content

Commit 8384a13

Browse files
brianquinlanCommit Queue
authored and
Commit Queue
committed
[doc] Document some limitations of Isolate.spawn.
Bug: #51594 Change-Id: Ib1aa733fd0f6641b53c32e9097f5b6e400226fa0 CoreLibraryReviewExempt: documentation only Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290262 Commit-Queue: Brian Quinlan <[email protected]> Reviewed-by: Ryan Macnak <[email protected]>
1 parent 6333e31 commit 8384a13

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

sdk/lib/isolate/isolate.dart

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,13 +341,21 @@ class Isolate {
341341
/// as the only argument.
342342
///
343343
/// The [entryPoint] function must be able to be called with a single
344-
/// argument,that is, a function which accepts at least one positional
344+
/// argument, that is, a function which accepts at least one positional
345345
/// parameter and has at most one required positional parameter.
346346
/// The function may accept any number of optional parameters,
347-
/// as long as it *can* be called with just a single argument.
347+
/// as long as it *can* be called with just a single argument. If
348+
/// [entryPoint] is a closure then it may implicitly send unexpected state
349+
/// to the isolate due to limitations in the Dart implementation. This can
350+
/// cause performance issues, increased memory usage
351+
/// (see http://dartbug.com/36983) or, if the state includes objects that
352+
/// can't be spent between isolates, a runtime failure. See [run] for an
353+
/// example.
348354
///
349-
/// Usually the initial [message] contains a [SendPort] so
350-
/// that the spawner and spawnee can communicate with each other.
355+
/// [message] must be sendable between isolates. Objects that cannot be sent
356+
/// include open files and sockets (see [SendPort.send] for details). Usually
357+
/// the initial [message] contains a [SendPort] so that the spawner and
358+
/// spawnee can communicate with each other.
351359
///
352360
/// If the [paused] parameter is set to `true`,
353361
/// the isolate will start up in a paused state,

0 commit comments

Comments
 (0)