// This test may not always fail, but it can be flaky if the race it used to
// expose is still present.
-use std::comm::{channel, Sender, Receiver};
+use std::sync::mpsc::{channel, Sender, Receiver};
use std::thread::Thread;
fn helper(rx: Receiver<Sender<()>>) {
for tx in rx.iter() {
- let _ = tx.send_opt(());
+ let _ = tx.send(());
}
}
fn main() {
let (tx, rx) = channel();
- let _t = Thread::spawn(move|| { helper(rx) }).detach();
+ let _t = Thread::spawn(move|| { helper(rx) });
let (snd, rcv) = channel::<int>();
for _ in range(1i, 100000i) {
- snd.send(1i);
+ snd.send(1i).unwrap();
let (tx2, rx2) = channel();
- tx.send(tx2);
+ tx.send(tx2).unwrap();
select! {
- () = rx2.recv() => (),
+ _ = rx2.recv() => (),
_ = rcv.recv() => ()
}
}