diff options
author | Antoine Pitrou <pitrou@free.fr> | 2017-08-16 20:53:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-16 20:53:28 +0200 |
commit | ee84a608587b930176d37303afae8a4358e15990 (patch) | |
tree | aade6691a045b2dc375af1b1afa4c2dbc01e162c /Lib/threading.py | |
parent | bpo-31069, test_multiprocessing: Fix dangling process (#3103) (diff) | |
download | cpython-ee84a608587b930176d37303afae8a4358e15990.tar.gz cpython-ee84a608587b930176d37303afae8a4358e15990.tar.bz2 cpython-ee84a608587b930176d37303afae8a4358e15990.zip |
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
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 92c2ab365b4..06dbc682834 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. |