Skip to content

Commit 49b72bd

Browse files
committed
std::rt: Use a constant 4 threads for multithreaded sched tests. #7772
Too much overcommit here exhausts the low fd limit on OS X.
1 parent 93c270c commit 49b72bd

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/libstd/rt/test.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,17 @@ pub fn run_in_mt_newsched_task(f: ~fn()) {
6464
use os;
6565
use from_str::FromStr;
6666
use rt::sched::Shutdown;
67-
use rt::util;
6867

6968
let f_cell = Cell::new(f);
7069

7170
do run_in_bare_thread {
7271
let nthreads = match os::getenv("RUST_TEST_THREADS") {
7372
Some(nstr) => FromStr::from_str(nstr).get(),
7473
None => {
75-
// Using more threads than cores in test code
76-
// to force the OS to preempt them frequently.
77-
// Assuming that this help stress test concurrent types.
78-
util::num_cpus() * 2
74+
// A reasonable number of threads for testing
75+
// multithreading. NB: It's easy to exhaust OS X's
76+
// low maximum fd limit by setting this too high (#7772)
77+
4
7978
}
8079
};
8180

0 commit comments

Comments
 (0)