2020-03-26 02:28:14 +00:00
|
|
|
// program should terminate even if a thread is blocked on I/O.
|
|
|
|
// https://github.com/fortanix/rust-sgx/issues/109
|
|
|
|
|
|
|
|
//@ run-pass
|
2024-03-06 20:19:20 +00:00
|
|
|
//@ needs-threads
|
2020-03-26 02:28:14 +00:00
|
|
|
|
|
|
|
use std::{net::TcpListener, sync::mpsc, thread};
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let (tx, rx) = mpsc::channel();
|
|
|
|
thread::spawn(move || {
|
2021-06-27 13:53:27 +00:00
|
|
|
let listen = TcpListener::bind("127.0.0.1:0").unwrap();
|
2020-03-26 02:28:14 +00:00
|
|
|
tx.send(()).unwrap();
|
|
|
|
while let Ok(_) = listen.accept() {}
|
|
|
|
});
|
|
|
|
rx.recv().unwrap();
|
|
|
|
for _ in 0..3 { thread::yield_now(); }
|
|
|
|
println!("Exiting main thread");
|
|
|
|
}
|