about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorKevin Ballard <kevin@sb.org>2013-08-01 18:23:30 -0700
committerKevin Ballard <kevin@sb.org>2013-08-02 21:18:32 -0700
commit70d2be0cec5b61dec30677654123044b50bb11f7 (patch)
tree66b9d3839140ad9be9cc31ad2e7b93704b7ed5b1 /src/libstd
parent3ddc72f69be4d0a2027ff598ad262ea2b2ca3812 (diff)
downloadrust-70d2be0cec5b61dec30677654123044b50bb11f7.tar.gz
rust-70d2be0cec5b61dec30677654123044b50bb11f7.zip
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 49b72bdd77916e27aaf95909516702c1450f11ac.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/rt/test.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libstd/rt/test.rs b/src/libstd/rt/test.rs
index 1ed0703de4d..387ea3c62aa 100644
--- a/src/libstd/rt/test.rs
+++ b/src/libstd/rt/test.rs
@@ -70,6 +70,7 @@ pub fn run_in_mt_newsched_task(f: ~fn()) {
     use os;
     use from_str::FromStr;
     use rt::sched::Shutdown;
+    use rt::util;
 
     let f = Cell::new(f);
 
@@ -77,10 +78,10 @@ pub fn run_in_mt_newsched_task(f: ~fn()) {
         let nthreads = match os::getenv("RUST_RT_TEST_THREADS") {
             Some(nstr) => FromStr::from_str(nstr).get(),
             None => {
-                // A reasonable number of threads for testing
-                // multithreading. NB: It's easy to exhaust OS X's
-                // low maximum fd limit by setting this too high (#7772)
-                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.
+                util::num_cpus() * 2
             }
         };