From 3d5a1d35408e0824bf22ef53d3810dd993a4dadc Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Tue, 17 Jun 2008 19:49:43 +0000 Subject: [PATCH] Join listening thread in signalreceiver on shutdown --- deluge/ui/signalreceiver.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/deluge/ui/signalreceiver.py b/deluge/ui/signalreceiver.py index 610ece94a..3aab91b05 100644 --- a/deluge/ui/signalreceiver.py +++ b/deluge/ui/signalreceiver.py @@ -74,6 +74,8 @@ class SignalReceiver(ThreadingMixIn, SimpleXMLRPCServer.SimpleXMLRPCServer): log.debug("Shutting down signalreceiver") self.socket.shutdown(socket.SHUT_RDWR) + log.debug("Joining listening thread..") + self.listening_thread.join(1.0) return def set_remote(self, remote): @@ -107,12 +109,12 @@ class SignalReceiver(ThreadingMixIn, SimpleXMLRPCServer.SimpleXMLRPCServer): # Register the signal receiver with the core client.register_client(str(self.port)) - t = threading.Thread(target=self.handle_thread) + self.listening_thread = threading.Thread(target=self.handle_thread) gobject.timeout_add(50, self.handle_signals) try: - t.start() + self.listening_thread.start() except Exception, e: log.debug("Thread: %s", e)