From 9e9b8b17f829561c8fc4c34128e086536fd61277 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 15 Feb 2018 00:00:31 -0800 Subject: [PATCH] Only build the threadpool if customized --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 8f2b6d2..49ea740 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -897,13 +897,13 @@ impl Build { fn compile_objects(&self, objs: &[Object]) -> Result<(), Error> { use self::rayon::prelude::*; - let mut builder = rayon::ThreadPoolBuilder::new(); if let Ok(amt) = env::var("NUM_JOBS") { 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>> = Mutex::new(Vec::new());