Skip to content

Commit

Permalink
clean up stop and shutdown.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkassner committed Nov 23, 2015
1 parent e7b90a6 commit 7d5c927
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pupil_src/shared_modules/network_time_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
5 changes: 3 additions & 2 deletions pupil_src/shared_modules/pupil_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 7d5c927

Please sign in to comment.