mirror of https://gitlab.com/ita1024/waf.git
Better task cleanup logic
This commit is contained in:
parent
248d89e85b
commit
df956ed5c5
|
@ -29,12 +29,13 @@ class Consumer(Utils.threading.Thread):
|
||||||
self.start()
|
self.start()
|
||||||
def run(self):
|
def run(self):
|
||||||
try:
|
try:
|
||||||
self.task.process()
|
if not self.spawner.master.stop:
|
||||||
|
self.task.process()
|
||||||
finally:
|
finally:
|
||||||
|
self.spawner.sem.release()
|
||||||
self.spawner.master.out.put(self.task)
|
self.spawner.master.out.put(self.task)
|
||||||
self.spawner.sem.release()
|
self.task = None
|
||||||
self.task = None
|
self.spawner = None
|
||||||
self.spawner = None
|
|
||||||
|
|
||||||
class Spawner(Utils.threading.Thread):
|
class Spawner(Utils.threading.Thread):
|
||||||
def __init__(self, master):
|
def __init__(self, master):
|
||||||
|
|
|
@ -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`.
|
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).
|
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
|
# remove the task signature immediately before it is executed
|
||||||
# in case of failure the task will be executed again
|
# in case of failure the task will be executed again
|
||||||
try:
|
try:
|
||||||
# TODO waf 1.9 - this breaks encapsulation
|
# TODO another place for this?
|
||||||
del self.generator.bld.task_sigs[self.uid()]
|
del self.generator.bld.task_sigs[self.uid()]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue