]> git.lizzy.rs Git - rust.git/blob - src/test/ui/threads-sendsync/comm.rs
Merge commit 'e18101137866b79045fee0ef996e696e68c920b4' into clippyup
[rust.git] / src / test / ui / threads-sendsync / comm.rs
1 // run-pass
2 #![allow(unused_must_use)]
3 // ignore-emscripten no threads support
4
5 use std::thread;
6 use std::sync::mpsc::{channel, Sender};
7
8 pub fn main() {
9     let (tx, rx) = channel();
10     let t = thread::spawn(move|| { child(&tx) });
11     let y = rx.recv().unwrap();
12     println!("received");
13     println!("{}", y);
14     assert_eq!(y, 10);
15     t.join();
16 }
17
18 fn child(c: &Sender<isize>) {
19     println!("sending");
20     c.send(10).unwrap();
21     println!("value sent");
22 }