From 9d7aa2c51f0225832deb4a03d278e12653f36b98 Mon Sep 17 00:00:00 2001 From: Jarrod Johnon Date: Tue, 7 Oct 2014 15:30:29 -0400 Subject: [PATCH] Prevent control thread from blocking exit If a control socket was created, exit() would block due to the non-daemon thread. Mark the thread as daemon to allow for unclean shutdown. --- confluent_client/confluent/termhandler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/confluent_client/confluent/termhandler.py b/confluent_client/confluent/termhandler.py index 986b2229..c628a0dd 100644 --- a/confluent_client/confluent/termhandler.py +++ b/confluent_client/confluent/termhandler.py @@ -37,7 +37,9 @@ class TermHandler(object): atexit.register(self.shutdown) self.socket.bind(path) os.chmod(path, stat.S_IWUSR | stat.S_IRUSR) - threading.Thread(target=self.sockinteract).start() + th = threading.Thread(target=self.sockinteract) + th.daemon = True + th.start() def shutdown(self): try: