Ensure graceful teardown of the reactor thread

This commit is contained in:
Ole André Vadla Ravnås
2015-06-15 18:29:08 +02:00
parent ef670d8885
commit b22a895ddd
+4 -3
View File
@@ -271,12 +271,13 @@ class Reactor(object):
with self._lock:
self._running = True
watcher_thread = threading.Thread(target=self._run)
watcher_thread.daemon = True
watcher_thread.start()
worker = threading.Thread(target=self._run)
worker.start()
self._run_until_return(self)
self.stop()
worker.join()
def _run(self):
running = True