@@ -2385,8 +2385,7 @@ The argument to `task::spawn()` is a [unique
2385
2385
closure] ( #unique-closures ) of type ` fn~() ` , meaning that it takes no
2386
2386
arguments and generates no return value. The effect of ` task::spawn() `
2387
2387
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.
2390
2389
2391
2390
## Ports and channels
2392
2391
@@ -2402,10 +2401,10 @@ in parallel. We might write something like:
2402
2401
# fn some_other_expensive_computation() {}
2403
2402
let port = comm::port::<int>();
2404
2403
let chan = comm::chan::<int>(port);
2405
- let child_task = task::spawn {||
2404
+ task::spawn {||
2406
2405
let result = some_expensive_computation();
2407
2406
comm::send(chan, result);
2408
- };
2407
+ }
2409
2408
some_other_expensive_computation();
2410
2409
let result = comm::recv(port);
2411
2410
~~~~
@@ -2433,10 +2432,10 @@ The next statement actually spawns the child:
2433
2432
# fn some_expensive_computation() -> int { 42 }
2434
2433
# let port = comm::port::<int>();
2435
2434
# let chan = comm::chan::<int>(port);
2436
- let child_task = task::spawn {||
2435
+ task::spawn {||
2437
2436
let result = some_expensive_computation();
2438
2437
comm::send(chan, result);
2439
- };
2438
+ }
2440
2439
~~~~
2441
2440
2442
2441
This child will perform the expensive computation send the result
0 commit comments