// except according to those terms.
use std::sync::mpsc::{channel, Sender};
-use std::task;
+use std::thread::Thread;
pub fn main() {
let (tx, rx) = channel();
while (i > 0) {
println!("{}", i);
let tx = tx.clone();
- task::spawn({let i = i; move|| { child(i, &tx) }});
+ Thread::spawn({let i = i; move|| { child(i, &tx) }});
i = i - 1;
}
i = 10;
while (i > 0) {
println!("{}", i);
- rx.recv();
+ rx.recv().unwrap();
i = i - 1;
}
fn child(x: int, tx: &Sender<int>) {
println!("{}", x);
- tx.send(x);
+ tx.send(x).unwrap();
}