]> git.lizzy.rs Git - rust.git/blob - tests/ui/process-termination/process-termination-blocking-io.rs
Auto merge of #106711 - albertlarsan68:use-ci-llvm-when-lld, r=jyn514
[rust.git] / tests / ui / process-termination / process-termination-blocking-io.rs
1 // program should terminate even if a thread is blocked on I/O.
2 // https://github.com/fortanix/rust-sgx/issues/109
3
4 // run-pass
5 // ignore-emscripten no threads support
6
7 use std::{net::TcpListener, sync::mpsc, thread};
8
9 fn main() {
10     let (tx, rx) = mpsc::channel();
11     thread::spawn(move || {
12         let listen = TcpListener::bind("127.0.0.1:0").unwrap();
13         tx.send(()).unwrap();
14         while let Ok(_) = listen.accept() {}
15     });
16     rx.recv().unwrap();
17     for _ in 0..3 { thread::yield_now(); }
18     println!("Exiting main thread");
19 }