diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-03-27 10:07:53 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-03-27 10:07:53 -0700 |
| commit | aff160bb0343c9d09b93b2deb045ae51d18ade34 (patch) | |
| tree | 47f3af7e6ee60e7bb0a008320918f1429e16291e /src/test | |
| parent | 45f1324037b098d6e92da7b34cc0aba274fdae97 (diff) | |
| parent | fa3840305c7aad322ef76453748ad44f7f0eba1b (diff) | |
| download | rust-aff160bb0343c9d09b93b2deb045ae51d18ade34.tar.gz rust-aff160bb0343c9d09b93b2deb045ae51d18ade34.zip | |
rollup merge of #23775: alexcrichton/fix-flaky-test
Windows gets quite unhappy when a thread fails while the main thread is exiting, frequently leading to process deadlock. This has been causing quite a few deadlocks on the windows bots recently. The child threads are presumably failing because the `println!` is failing due to the main thread being shut down.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/run-pass/spawn-fn.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/test/run-pass/spawn-fn.rs b/src/test/run-pass/spawn-fn.rs index 4f8ba7f655e..efddf0455cd 100644 --- a/src/test/run-pass/spawn-fn.rs +++ b/src/test/run-pass/spawn-fn.rs @@ -8,23 +8,21 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(std_misc)] +use std::thread; -use std::thread::Thread; - -fn x(s: String, n: int) { +fn x(s: String, n: isize) { println!("{}", s); println!("{}", n); } pub fn main() { - let _t = Thread::spawn(|| x("hello from first spawned fn".to_string(), 65) ); - let _t = Thread::spawn(|| x("hello from second spawned fn".to_string(), 66) ); - let _t = Thread::spawn(|| x("hello from third spawned fn".to_string(), 67) ); - let mut i: int = 30; + let _t = thread::scoped(|| x("hello from first spawned fn".to_string(), 65) ); + let _t = thread::scoped(|| x("hello from second spawned fn".to_string(), 66) ); + let _t = thread::scoped(|| x("hello from third spawned fn".to_string(), 67) ); + let mut i = 30; while i > 0 { i = i - 1; println!("parent sleeping"); - Thread::yield_now(); + thread::yield_now(); } } |
