We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3ddc72f commit 70d2be0Copy full SHA for 70d2be0
src/libstd/rt/test.rs
@@ -70,17 +70,18 @@ pub fn run_in_mt_newsched_task(f: ~fn()) {
70
use os;
71
use from_str::FromStr;
72
use rt::sched::Shutdown;
73
+ use rt::util;
74
75
let f = Cell::new(f);
76
77
do run_in_bare_thread {
78
let nthreads = match os::getenv("RUST_RT_TEST_THREADS") {
79
Some(nstr) => FromStr::from_str(nstr).get(),
80
None => {
- // A reasonable number of threads for testing
81
- // multithreading. NB: It's easy to exhaust OS X's
82
- // low maximum fd limit by setting this too high (#7772)
83
- 4
+ // Using more threads than cores in test code
+ // to force the OS to preempt them frequently.
+ // Assuming that this help stress test concurrent types.
84
+ util::num_cpus() * 2
85
}
86
};
87
0 commit comments