]> git.lizzy.rs Git - rust.git/blob - src/test/ui/threads-sendsync/task-comm-13.rs
Rollup merge of #100861 - RalfJung:const-ice, r=oli-obk
[rust.git] / src / test / ui / threads-sendsync / task-comm-13.rs
1 // run-pass
2 #![allow(unused_variables)]
3 // ignore-emscripten no threads support
4
5 use std::sync::mpsc::{channel, Sender};
6 use std::thread;
7
8 fn start(tx: &Sender<isize>, start: isize, number_of_messages: isize) {
9     let mut i: isize = 0;
10     while i< number_of_messages { tx.send(start + i).unwrap(); i += 1; }
11 }
12
13 pub fn main() {
14     println!("Check that we don't deadlock.");
15     let (tx, rx) = channel();
16     let _ = thread::spawn(move|| { start(&tx, 0, 10) }).join();
17     println!("Joined task");
18 }