about summary refs log tree commit diff
path: root/tests/ui/threads-sendsync/yield.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/threads-sendsync/yield.rs')
-rw-r--r--tests/ui/threads-sendsync/yield.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/threads-sendsync/yield.rs b/tests/ui/threads-sendsync/yield.rs
new file mode 100644
index 00000000000..e83ba556078
--- /dev/null
+++ b/tests/ui/threads-sendsync/yield.rs
@@ -0,0 +1,21 @@
+// run-pass
+
+#![allow(unused_must_use)]
+#![allow(unused_mut)]
+// ignore-emscripten no threads support
+
+use std::thread;
+
+pub fn main() {
+    let mut result = thread::spawn(child);
+    println!("1");
+    thread::yield_now();
+    println!("2");
+    thread::yield_now();
+    println!("3");
+    result.join();
+}
+
+fn child() {
+    println!("4"); thread::yield_now(); println!("5"); thread::yield_now(); println!("6");
+}