summaryrefslogtreecommitdiffstats
path: root/src/build.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/build.cc')
-rw-r--r--src/build.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/build.cc b/src/build.cc
index 64bcea3..fb1cc74 100644
--- a/src/build.cc
+++ b/src/build.cc
@@ -488,7 +488,9 @@ void RealCommandRunner::Abort() {
}
bool RealCommandRunner::CanRunMore() {
- return ((int)subprocs_.running_.size()) < config_.parallelism
+ size_t subproc_number =
+ subprocs_.running_.size() + subprocs_.finished_.size();
+ return (int)subproc_number < config_.parallelism
&& ((subprocs_.running_.empty() || config_.max_load_average <= 0.0f)
|| GetLoadAverage() < config_.max_load_average);
}