]> git.proxmox.com Git - rustc.git/blame - src/test/ui/threads-sendsync/task-comm-15.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / threads-sendsync / task-comm-15.rs
CommitLineData
b7449926 1// run-pass
0bf4aa26 2#![allow(unused_must_use)]
7453a54e 3// ignore-emscripten no threads support
c34b1796
AL
4// pretty-expanded FIXME #23616
5
1a4d82fc 6use std::sync::mpsc::{channel, Sender};
c34b1796 7use std::thread;
223e47cc 8
c34b1796 9fn start(tx: &Sender<isize>, i0: isize) {
223e47cc
LB
10 let mut i = i0;
11 while i > 0 {
1a4d82fc 12 tx.send(0).unwrap();
223e47cc
LB
13 i = i - 1;
14 }
15}
16
17pub fn main() {
bd371182 18 // Spawn a thread that sends us back messages. The parent thread
223e47cc
LB
19 // is likely to terminate before the child completes, so from
20 // the child's point of view the receiver may die. We should
21 // drop messages on the floor in this case, and not crash!
1a4d82fc 22 let (tx, rx) = channel();
9346a6ac 23 let t = thread::spawn(move|| {
1a4d82fc
JJ
24 start(&tx, 10)
25 });
26 rx.recv();
9346a6ac 27 t.join();
223e47cc 28}