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