]> git.lizzy.rs Git - rust.git/blob - src/test/ui/sleep.rs
3b3a4a4f3250cb21d66b98a7a535a7618167fef5
[rust.git] / src / test / ui / sleep.rs
1 // run-pass
2 // ignore-emscripten no threads support
3
4 use std::thread::{self, sleep};
5 use std::time::Duration;
6 use std::sync::{Arc, Mutex};
7 use std::u64;
8
9 fn main() {
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;
15     });
16     sleep(Duration::from_millis(100));
17     assert_eq!(*finished.lock().unwrap(), false);
18 }