summaryrefslogtreecommitdiffstats
path: root/library/std/tests/thread.rs
diff options
context:
space:
mode:
Diffstat (limited to 'library/std/tests/thread.rs')
-rw-r--r--library/std/tests/thread.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/library/std/tests/thread.rs b/library/std/tests/thread.rs
new file mode 100644
index 000000000..754b264c6
--- /dev/null
+++ b/library/std/tests/thread.rs
@@ -0,0 +1,16 @@
+use std::sync::{Arc, Mutex};
+use std::thread;
+use std::time::Duration;
+
+#[test]
+#[cfg_attr(target_os = "emscripten", ignore)]
+fn sleep() {
+ let finished = Arc::new(Mutex::new(false));
+ let t_finished = finished.clone();
+ thread::spawn(move || {
+ thread::sleep(Duration::new(u64::MAX, 0));
+ *t_finished.lock().unwrap() = true;
+ });
+ thread::sleep(Duration::from_millis(100));
+ assert_eq!(*finished.lock().unwrap(), false);
+}