Cleanup proc comment in guide-tasks.md.
This commit is contained in:
parent
dcde1ee163
commit
0fb1f3fd38
|
@ -89,9 +89,10 @@ closure in the new task.
|
||||||
fn print_message() { println!("I am running in a different task!"); }
|
fn print_message() { println!("I am running in a different task!"); }
|
||||||
spawn(print_message);
|
spawn(print_message);
|
||||||
|
|
||||||
// Print something more profound in a different task using a lambda expression
|
// Print something profound in a different task using a `proc` expression
|
||||||
// This uses the proc() keyword to assign to spawn a function with no name
|
// The `proc` expression evaluates to an (unnamed) owned closure.
|
||||||
// That function will call println!(...) as requested
|
// That closure will call `println!(...)` when the spawned task runs.
|
||||||
|
|
||||||
spawn(proc() println!("I am also running in a different task!") );
|
spawn(proc() println!("I am also running in a different task!") );
|
||||||
~~~~
|
~~~~
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue