]> git.lizzy.rs Git - rust.git/blob - src/test/ui/sleep.rs
Rollup merge of #61207 - taiki-e:arbitrary_self_types-lifetime-elision-2, r=Centril
[rust.git] / src / test / ui / sleep.rs
1 // run-pass
2 // ignore-emscripten no threads support
3 // ignore-sgx no thread sleep support
4
5 use std::thread::{self, sleep};
6 use std::time::Duration;
7 use std::sync::{Arc, Mutex};
8 use std::u64;
9
10 fn main() {
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;
16     });
17     sleep(Duration::from_millis(100));
18     assert_eq!(*finished.lock().unwrap(), false);
19 }