aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Pitrou <pitrou@free.fr>2017-08-16 20:53:28 +0200
committerGitHub <noreply@github.com>2017-08-16 20:53:28 +0200
commitee84a608587b930176d37303afae8a4358e15990 (patch)
treeaade6691a045b2dc375af1b1afa4c2dbc01e162c /Lib/threading.py
parentbpo-31069, test_multiprocessing: Fix dangling process (#3103) (diff)
downloadcpython-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.py3
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.