Skip to content

Commit 57af1e9

Browse files
committed
doc: Update tutorial for task API changes
1 parent 91b988e commit 57af1e9

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

doc/tutorial.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -2385,8 +2385,7 @@ The argument to `task::spawn()` is a [unique
23852385
closure](#unique-closures) of type `fn~()`, meaning that it takes no
23862386
arguments and generates no return value. The effect of `task::spawn()`
23872387
is to fire up a child task that will execute the closure in parallel
2388-
with the creator. The result is a task id, here stored into the
2389-
variable `child_task`.
2388+
with the creator.
23902389

23912390
## Ports and channels
23922391

@@ -2402,10 +2401,10 @@ in parallel. We might write something like:
24022401
# fn some_other_expensive_computation() {}
24032402
let port = comm::port::<int>();
24042403
let chan = comm::chan::<int>(port);
2405-
let child_task = task::spawn {||
2404+
task::spawn {||
24062405
let result = some_expensive_computation();
24072406
comm::send(chan, result);
2408-
};
2407+
}
24092408
some_other_expensive_computation();
24102409
let result = comm::recv(port);
24112410
~~~~
@@ -2433,10 +2432,10 @@ The next statement actually spawns the child:
24332432
# fn some_expensive_computation() -> int { 42 }
24342433
# let port = comm::port::<int>();
24352434
# let chan = comm::chan::<int>(port);
2436-
let child_task = task::spawn {||
2435+
task::spawn {||
24372436
let result = some_expensive_computation();
24382437
comm::send(chan, result);
2439-
};
2438+
}
24402439
~~~~
24412440

24422441
This child will perform the expensive computation send the result

0 commit comments

Comments
 (0)