summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Job.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2005-05-04 04:31:58 (GMT)
committerSteven Knight <knight@baldmt.com>2005-05-04 04:31:58 (GMT)
commitd629cdf3f3b332a1b3c9c9fa550c90b8dd710766 (patch)
tree2181bddf41015b1797ee61f510bc4766585bddcd /src/engine/SCons/Job.py
parent39b176fbfd91894dea7eb5877e463d0990a3e0a3 (diff)
downloadSCons-d629cdf3f3b332a1b3c9c9fa550c90b8dd710766.zip
SCons-d629cdf3f3b332a1b3c9c9fa550c90b8dd710766.tar.gz
SCons-d629cdf3f3b332a1b3c9c9fa550c90b8dd710766.tar.bz2
Reap as many thread responses as possible at once. (J.T. Conklin)
Diffstat (limited to 'src/engine/SCons/Job.py')
-rw-r--r--src/engine/SCons/Job.py37
1 files changed, 15 insertions, 22 deletions
diff --git a/src/engine/SCons/Job.py b/src/engine/SCons/Job.py
index 2d4dbf8..60eb861 100644
--- a/src/engine/SCons/Job.py
+++ b/src/engine/SCons/Job.py
@@ -222,21 +222,8 @@ else:
jobs = 0
while 1:
-
- # There's a concern here that the while-loop test below
- # might delay reporting status back about failed build
- # tasks until the entire build is done if tasks execute
- # fast enough, or self.maxjobs is big enough. It looks
- # like that's enough of a corner case that we'll wait to
- # see if it's an issue in practice. If so, one possible
- # fix might be:
- #
- # while jobs < self.maxjobs and \
- # self.tp.resultsQueue.empty():
- #
- # but that's somewhat unattractive because the
- # resultsQueue.empty() check might introduce some
- # significant overhead involving mutex locking.
+ # Start up as many available tasks as we're
+ # allowed to.
while jobs < self.maxjobs:
task = self.taskmaster.next_task()
if task is None:
@@ -261,12 +248,18 @@ else:
if not task and not jobs: break
- task, ok = self.tp.get()
+ # Let any/all completed tasks finish up before we go
+ # back and put the next batch of tasks on the queue.
+ while 1:
+ task, ok = self.tp.get()
- jobs = jobs - 1
- if ok:
- task.executed()
- else:
- task.failed()
+ jobs = jobs - 1
+ if ok:
+ task.executed()
+ else:
+ task.failed()
- task.postprocess()
+ task.postprocess()
+
+ if self.tp.resultsQueue.empty():
+ break