diff options
| author | Jeffrey Yasskin <[email protected]> | 2010-08-08 19:24:35 -0700 |
|---|---|---|
| committer | Jeffrey Yasskin <[email protected]> | 2010-08-09 11:43:16 +0200 |
| commit | b71340552fa0caa870877f87a1273e8d4c91efe6 (patch) | |
| tree | a1a1883cded2c8541a817d41d91c2002a926207b /doc/rust.texi | |
| parent | Fix LLVM translation of modules. (diff) | |
| download | rust-b71340552fa0caa870877f87a1273e8d4c91efe6.tar.xz rust-b71340552fa0caa870877f87a1273e8d4c91efe6.zip | |
Add names to tasks and domains. These can either be an explicit literal string
after the "spawn" keyword, or implicitly the call expression used to start the
spawn.
Diffstat (limited to 'doc/rust.texi')
| -rw-r--r-- | doc/rust.texi | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/doc/rust.texi b/doc/rust.texi index 3aa079d7..63181f88 100644 --- a/doc/rust.texi +++ b/doc/rust.texi @@ -2822,12 +2822,15 @@ x.y = z + 2; @c * Ref.Stmt.Spawn:: Statements creating new tasks. @cindex Spawn statement -A @code{spawn} statement consists of keyword @code{spawn}, followed by a -normal @emph{call} statement (@pxref{Ref.Stmt.Call}). A @code{spawn} -statement causes the runtime to construct a new task executing the called -function. The called function is referred to as the @dfn{entry function} for -the spawned task, and its arguments are copied from the spawning task to the -spawned task before the spawned task begins execution. +A @code{spawn} statement consists of keyword @code{spawn}, followed by +an optional literal string naming the new task and then a normal +@emph{call} statement (@pxref{Ref.Stmt.Call}). A @code{spawn} +statement causes the runtime to construct a new task executing the +called function with the given name. The called function is referred +to as the @dfn{entry function} for the spawned task, and its arguments +are copied from the spawning task to the spawned task before the +spawned task begins execution. If no explicit name is present, the +task is implicitly named with the string of the call statement. Functions taking alias-slot arguments, or returning non-nil values, cannot be spawned. Iterators cannot be spawned. @@ -2843,6 +2846,7 @@ fn helper(chan[u8] out) @{ let port[u8] out; let task p = spawn helper(chan(out)); +let task p2 = spawn "my_helper" helper(chan(out)); // let task run, do other things. auto result <- out; |