@@ -366,17 +366,22 @@ impl TaskBuilder {
366
366
}
367
367
368
368
// Construct the future and give it to the caller.
369
- let (ch, po ) = stream::<Notification>();
369
+ let (notify_pipe_ch, notify_pipe_po ) = stream::<Notification>();
370
370
371
371
blk(do future::from_fn {
372
- match po .recv() {
372
+ match notify_pipe_po .recv() {
373
373
Exit(_, result) => result
374
374
}
375
375
});
376
376
377
377
// Reconfigure self to use a notify channel.
378
378
TaskBuilder({
379
- opts: { notify_chan: Some(ch),.. self.opts },
379
+ opts: {
380
+ linked: self.opts.linked,
381
+ supervised: self.opts.supervised,
382
+ mut notify_chan: Some(notify_pipe_ch),
383
+ sched: self.opts.sched
384
+ },
380
385
can_not_copy: None,
381
386
.. *self.consume()
382
387
})
@@ -445,12 +450,14 @@ impl TaskBuilder {
445
450
* must be greater than zero.
446
451
*/
447
452
fn spawn(+f: fn~()) {
448
- let x = self.consume();
449
- let notify_chan = if self.opts.notify_chan == None {
453
+ let notify_chan = if self.opts.notify_chan == none {
450
454
None
451
455
} else {
452
- Some(option::swap_unwrap(&mut self.opts.notify_chan))
456
+ let swapped_notify_chan =
457
+ option::swap_unwrap(&mut self.opts.notify_chan);
458
+ some(swapped_notify_chan)
453
459
};
460
+ let x = self.consume();
454
461
let opts = {
455
462
linked: x.opts.linked,
456
463
supervised: x.opts.supervised,
@@ -522,7 +529,8 @@ impl TaskBuilder {
522
529
let ch = comm::Chan(po);
523
530
let mut result = None;
524
531
525
- do self.future_result(|+r| { result = Some(r); }).spawn {
532
+ let fr_task_builder = self.future_result(|+r| { result = Some(r); });
533
+ do fr_task_builder.spawn {
526
534
comm::send(ch, f());
527
535
}
528
536
match future::get(&option::unwrap(result)) {
0 commit comments