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)
commit87138ba14bbf227ea8c8ab801f03c54486f3aab1 (patch)
tree2181bddf41015b1797ee61f510bc4766585bddcd /src/engine/SCons/Job.py
parent44f9f0abbaeef0c902020de2beca33350f4f1a0a (diff)
downloadSCons-87138ba14bbf227ea8c8ab801f03c54486f3aab1.zip
SCons-87138ba14bbf227ea8c8ab801f03c54486f3aab1.tar.gz
SCons-87138ba14bbf227ea8c8ab801f03c54486f3aab1.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