diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/threads-sendsync/yield.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/threads-sendsync/yield.rs b/src/test/ui/threads-sendsync/yield.rs new file mode 100644 index 000000000..e83ba5560 --- /dev/null +++ b/src/test/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"); +} |