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
This commit is contained in:
Antoine Pitrou 2017-08-16 20:53:28 +02:00 committed by GitHub
parent 17657bb945
commit ee84a60858
4 changed files with 33 additions and 0 deletions

View file

@ -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.