Skip to content

Commit 70d2be0

Browse files
committed
Revert "std::rt: Use a constant 4 threads for multithreaded sched tests"
This workaround was less than ideal. A better solution is to raise the fd limit. This reverts commit 49b72bd.
1 parent 3ddc72f commit 70d2be0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/libstd/rt/test.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,18 @@ pub fn run_in_mt_newsched_task(f: ~fn()) {
7070
use os;
7171
use from_str::FromStr;
7272
use rt::sched::Shutdown;
73+
use rt::util;
7374

7475
let f = Cell::new(f);
7576

7677
do run_in_bare_thread {
7778
let nthreads = match os::getenv("RUST_RT_TEST_THREADS") {
7879
Some(nstr) => FromStr::from_str(nstr).get(),
7980
None => {
80-
// 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
81+
// Using more threads than cores in test code
82+
// to force the OS to preempt them frequently.
83+
// Assuming that this help stress test concurrent types.
84+
util::num_cpus() * 2
8485
}
8586
};
8687

0 commit comments

Comments
 (0)