From f827db2d84b14983a4e5305a57c0a1f7850da684 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Fri, 20 Apr 2018 22:57:17 -0500
Subject: [PATCH] Make delayed-start logging thread a daemon so as to not delay
 interpreter exit

---
 pytools/__init__.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/pytools/__init__.py b/pytools/__init__.py
index cd24848..3d03cfa 100644
--- a/pytools/__init__.py
+++ b/pytools/__init__.py
@@ -2104,10 +2104,14 @@ class ProcessLogger(object):
             self.time_start = timeit.default_timer()
 
         import threading
-        self.late_start_log_thread = threading.Thread(target=self.log_start_if_long)
+        self.late_start_log_thread = threading.Thread(target=self._log_start_if_long)
+
+        # Do not delay interpreter exit if thread not finished.
+        self.late_start_log_thread.daemon = True
+
         self.late_start_log_thread.start()
 
-    def log_start_if_long(self):
+    def _log_start_if_long(self):
         from time import sleep
 
         sleep_duration = 10*self.long_threshold_seconds
-- 
GitLab