]> git.lizzy.rs Git - rust.git/blob - library/std/tests/thread.rs
Sync rust-lang/portable-simd@5f49d4c8435a25d804b2f375e949cb25479f5be9
[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 }