Better task cleanup logic

This commit is contained in:
Thomas Nagy 2016-02-28 10:13:03 +01:00
parent 248d89e85b
commit df956ed5c5
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
2 changed files with 6 additions and 9 deletions

View File

@ -29,12 +29,13 @@ class Consumer(Utils.threading.Thread):
self.start()
def run(self):
try:
self.task.process()
if not self.spawner.master.stop:
self.task.process()
finally:
self.spawner.sem.release()
self.spawner.master.out.put(self.task)
self.spawner.sem.release()
self.task = None
self.spawner = None
self.task = None
self.spawner = None
class Spawner(Utils.threading.Thread):
def __init__(self, master):

View File

@ -200,14 +200,10 @@ class TaskBase(evil):
Assume that the task has had a ``master`` which is an instance of :py:class:`waflib.Runner.Parallel`.
Execute the task and then put it back in the queue :py:attr:`waflib.Runner.Parallel.out` (may be replaced by subclassing).
"""
m = self.generator.bld.producer
if m.stop:
return
# remove the task signature immediately before it is executed
# in case of failure the task will be executed again
try:
# TODO waf 1.9 - this breaks encapsulation
# TODO another place for this?
del self.generator.bld.task_sigs[self.uid()]
except KeyError:
pass