Browse Source

Update to rayon 1.0

cl-test
Josh Stone 7 years ago
parent
commit
80ea3c26e5
  1. 2
      Cargo.toml
  2. 6
      src/lib.rs

2
Cargo.toml

@ -21,7 +21,7 @@ travis-ci = { repository = "alexcrichton/cc-rs" }
appveyor = { repository = "alexcrichton/cc-rs" }
[dependencies]
rayon = { version = "0.9", optional = true }
rayon = { version = "1.0", optional = true }
[features]
parallel = ["rayon"]

6
src/lib.rs

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

Loading…
Cancel
Save