We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
std::thread::available_parallelism
1 parent 59578ad commit 041a0a8Copy full SHA for 041a0a8
src/parallel/job_token.rs
@@ -238,9 +238,10 @@ mod inprocess_jobserver {
238
// Note that we could use `num_cpus` here but it's an extra
239
// dependency that will almost never be used, so
240
// it's generally not too worth it.
241
- let mut parallelism = 4;
242
- // TODO: Use std::thread::available_parallelism as an upper bound
243
- // when MSRV is bumped.
+
+ let mut parallelism = std::thread::available_parallelism()
+ .map(|v| u32::from(v))
244
+ .unwrap_or(4);
245
if let Ok(amt) = var("NUM_JOBS") {
246
if let Ok(amt) = amt.parse() {
247
parallelism = amt;
0 commit comments