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