Avoid daemon threads

See #291
This commit is contained in:
Markus Unterwaditzer 2015-11-06 18:09:54 +01:00
parent 20e04e6bff
commit b7542fb536

View file

@ -410,12 +410,11 @@ class WorkerQueue(object):
self._shutdown_handlers = []
def shutdown(self):
if not self._queue.unfinished_tasks:
for handler in self._shutdown_handlers:
try:
handler()
except Exception:
pass
while self._shutdown_handlers:
try:
self._shutdown_handlers.pop()()
except Exception:
pass
def _worker(self):
while True:
@ -439,7 +438,6 @@ class WorkerQueue(object):
return
t = click_threading.Thread(target=self._worker)
t.daemon = True
t.start()
self._workers.append(t)
@ -452,6 +450,8 @@ class WorkerQueue(object):
yield
ui_worker.run()
self._queue.join()
for worker in self._workers:
worker.join()
if self._exceptions:
sys.exit(1)