1 //@ignore-target-windows: no threads nor sleep on Windows
2 //@compile-flags: -Zmiri-ignore-leaks -Zmiri-disable-isolation
3 use std::sync::{Arc, Mutex};
5 use std::time::Duration;
8 let finished = Arc::new(Mutex::new(false));
9 let t_finished = finished.clone();
10 thread::spawn(move || {
11 // Sleep very, very long.
12 thread::sleep(Duration::new(u64::MAX, 0));
13 *t_finished.lock().unwrap() = true;
15 thread::sleep(Duration::from_millis(100));
16 assert_eq!(*finished.lock().unwrap(), false);
17 // Stopping the main thread will also kill the sleeper.