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