diff options
Diffstat (limited to 'Lib/threading.py')
| -rw-r--r-- | Lib/threading.py | 3 |
1 files changed, 3 insertions, 0 deletions
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. |
