From ee84a608587b930176d37303afae8a4358e15990 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Wed, 16 Aug 2017 20:53:28 +0200 Subject: bpo-18966: non-daemonic threads created by a multiprocessing.Process should be joined on exit (#3111) * bpo-18966: non-daemonic threads created by a multiprocessing.Process should be joined on exit * Add NEWS blurb --- Lib/threading.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Lib/threading.py') diff --git a/Lib/threading.py b/Lib/threading.py index 92c2ab365b..06dbc68283 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -1284,6 +1284,9 @@ def _shutdown(): # the main thread's tstate_lock - that won't happen until the interpreter # is nearly dead. So we release it here. Note that just calling _stop() # isn't enough: other threads may already be waiting on _tstate_lock. + if _main_thread._is_stopped: + # _shutdown() was already called + return tlock = _main_thread._tstate_lock # The main thread isn't finished yet, so its thread state lock can't have # been released. -- cgit v1.2.1