From 7d5c927c53d0f0bd36e747de222b0c436b86fe5a Mon Sep 17 00:00:00 2001 From: Moritz Kassner Date: Mon, 23 Nov 2015 11:55:47 +0100 Subject: [PATCH] clean up stop and shutdown. --- pupil_src/shared_modules/network_time_sync.py | 2 ++ pupil_src/shared_modules/pupil_sync.py | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pupil_src/shared_modules/network_time_sync.py b/pupil_src/shared_modules/network_time_sync.py index 1b90e04a00..a0f4987068 100644 --- a/pupil_src/shared_modules/network_time_sync.py +++ b/pupil_src/shared_modules/network_time_sync.py @@ -93,6 +93,8 @@ def stop(self): self.server.socket.close() logger.debug("Server Thread closed") + def terminate(self): + self.stop() @property def port(self): diff --git a/pupil_src/shared_modules/pupil_sync.py b/pupil_src/shared_modules/pupil_sync.py index a4f6cad509..7e44673e63 100644 --- a/pupil_src/shared_modules/pupil_sync.py +++ b/pupil_src/shared_modules/pupil_sync.py @@ -170,10 +170,11 @@ def thread_loop(self,context,pipe): poller.register(back, zmq.POLLIN) def wake_up(): #on app close this timer calls a closed socket. We simply catch it here. + try: front.send('wake_up') except Exception as e: - logger.error(e) + logger.debug('Orphaned timer thread raised error: %s'%e) t = Timer(self.time_sync_announce_interval, wake_up) t.daemon = True @@ -348,7 +349,7 @@ def cleanup(self): This happens either volunatily or forced. """ if self.sync_node: - self.sync_node.stop() + self.sync_node.terminate() self.deinit_gui() self.thread_pipe.send(exit_thread) while self.thread_pipe: