sbt committed e1cd1f4 Draft

Issue #15101: Make pool finalizer avoid joining current thread.

Comments (0)

Files changed (2)


         # We must wait for the worker handler to exit before terminating
         # workers because we don't want workers to be restarted behind our back.
         debug('joining worker handler')
-        worker_handler.join()
+        if threading.current_thread() is not worker_handler:
+            worker_handler.join()
         # Terminate workers which haven't already finished.
         if pool and hasattr(pool[0], 'terminate'):
         debug('joining task handler')
-        task_handler.join()
+        if threading.current_thread() is not task_handler:
+            task_handler.join()
         debug('joining result handler')
-        result_handler.join()
+        if threading.current_thread() is not result_handler:
+            result_handler.join()
         if pool and hasattr(pool[0], 'terminate'):
             debug('joining pool workers')
+- Issue #15101: Make pool finalizer avoid joining current thread.
 - Issue #15036: Mailbox no longer throws an error if a flush is done
   between operations when removing or changing multiple items in mbox,
   MMDF, or Babyl mailboxes.