Handle task manager shutdown more correctly

If a task manager was stopped with tasks in queue, they would
not be processed.  This could result in deadlocked threads if
one of the long-running threads was waiting on a task while
the main thread shut down a manager.

Change-Id: I3f58c599d472d134984e63b41e9d493be9e9d70b
This commit is contained in:
James E. Blair 2014-06-17 08:07:35 -07:00
parent 0dc4b59b7d
commit 8ccc227b2d

View File

@ -71,9 +71,11 @@ class TaskManager(threading.Thread):
def run(self):
last_ts = 0
while self._running:
while True:
task = self.queue.get()
if not task:
if not self._running:
break
continue
while True:
delta = time.time() - last_ts