2 #![allow(unused_must_use)]
4 // ignore-emscripten no threads support
7 use std::sync::mpsc::{channel, Sender};
9 fn start(tx: &Sender<Sender<String>>) {
10 let (tx2, rx) = channel();
11 tx.send(tx2).unwrap();
15 a = rx.recv().unwrap();
16 assert_eq!(a, "A".to_string());
18 b = rx.recv().unwrap();
19 assert_eq!(b, "B".to_string());
24 let (tx, rx) = channel();
25 let child = thread::spawn(move|| { start(&tx) });
27 let mut c = rx.recv().unwrap();
28 c.send("A".to_string()).unwrap();
29 c.send("B".to_string()).unwrap();