Browse Source

Only build the threadpool if customized

cl-test
Josh Stone 7 years ago
parent
commit
9e9b8b17f8
  1. 6
      src/lib.rs

6
src/lib.rs

@ -897,13 +897,13 @@ impl Build {
fn compile_objects(&self, objs: &[Object]) -> Result<(), Error> { fn compile_objects(&self, objs: &[Object]) -> Result<(), Error> {
use self::rayon::prelude::*; use self::rayon::prelude::*;
let mut builder = rayon::ThreadPoolBuilder::new();
if let Ok(amt) = env::var("NUM_JOBS") { if let Ok(amt) = env::var("NUM_JOBS") {
if let Ok(amt) = amt.parse() { if let Ok(amt) = amt.parse() {
builder = builder.num_threads(amt); let _ = rayon::ThreadPoolBuilder::new()
.num_threads(amt)
.build_global();
} }
} }
drop(builder.build_global());
let results: Mutex<Vec<Result<(), Error>>> = Mutex::new(Vec::new()); let results: Mutex<Vec<Result<(), Error>>> = Mutex::new(Vec::new());

Loading…
Cancel
Save