]> git.lizzy.rs Git - rust.git/blob - src/test/ui/sleep.rs
Update tests to remove old numeric constants
[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
8 fn main() {
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;
14     });
15     sleep(Duration::from_millis(100));
16     assert_eq!(*finished.lock().unwrap(), false);
17 }