2 // ignore-emscripten no threads support
4 use std::thread::{self, sleep};
5 use std::time::Duration;
6 use std::sync::{Arc, Mutex};
9 let finished = Arc::new(Mutex::new(false));
10 let t_finished = finished.clone();
11 thread::spawn(move || {
12 sleep(Duration::new(u64::MAX, 0));
13 *t_finished.lock().unwrap() = true;
15 sleep(Duration::from_millis(100));
16 assert_eq!(*finished.lock().unwrap(), false);