Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/doc/guide-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ closure in the new task.
fn print_message() { println!("I am running in a different task!"); }
spawn(print_message);

// Print something more profound in a different task using a lambda expression
// This uses the proc() keyword to assign to spawn a function with no name
// That function will call println!(...) as requested
// Print something profound in a different task using a `proc` expression
// The `proc` expression evaluates to an (unnamed) owned closure.
// That closure will call `println!(...)` when the spawned task runs.

spawn(proc() println!("I am also running in a different task!") );
~~~~

Expand Down