]> git.lizzy.rs Git - rust.git/blob - library/std/tests/thread.rs
Merge commit '0cb0f7636851f9fcc57085cf80197a2ef6db098f' into clippyup
[rust.git] / library / std / tests / thread.rs
1 use std::sync::{Arc, Mutex};
2 use std::thread;
3 use std::time::Duration;
4
5 #[test]
6 #[cfg_attr(target_os = "emscripten", ignore)]
7 fn sleep() {
8     let finished = Arc::new(Mutex::new(false));
9     let t_finished = finished.clone();
10     thread::spawn(move || {
11         thread::sleep(Duration::new(u64::MAX, 0));
12         *t_finished.lock().unwrap() = true;
13     });
14     thread::sleep(Duration::from_millis(100));
15     assert_eq!(*finished.lock().unwrap(), false);
16 }