summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-12-18 18:28:33 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-12-18 18:28:33 (GMT)
commita74252633f2d86b3108b80c929583abd4193d7be (patch)
tree2ee79aeed464d65ed89d27cdd023b785ee144103
parent2bc801c4ea7b47d4b6db49e0ac0d9e0b3cfef010 (diff)
parent6d5f9e73d973a9ec5a68dfc0bc1859e6e4f50896 (diff)
downloadcpython-a74252633f2d86b3108b80c929583abd4193d7be.zip
cpython-a74252633f2d86b3108b80c929583abd4193d7be.tar.gz
cpython-a74252633f2d86b3108b80c929583abd4193d7be.tar.bz2
Merge
-rw-r--r--Lib/threading.py11
-rw-r--r--Misc/NEWS3
2 files changed, 7 insertions, 7 deletions
diff --git a/Lib/threading.py b/Lib/threading.py
index 6653f6e..043e6c8 100644
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -1068,21 +1068,18 @@ def _after_fork():
current = current_thread()
with _active_limbo_lock:
for thread in _active.values():
+ # Any lock/condition variable may be currently locked or in an
+ # invalid state, so we reinitialize them.
+ thread._reset_internal_locks()
if thread is current:
# There is only one active thread. We reset the ident to
# its new value since it can have changed.
ident = _get_ident()
thread._ident = ident
- # Any condition variables hanging off of the active thread may
- # be in an invalid state, so we reinitialize them.
- thread._reset_internal_locks()
new_active[ident] = thread
else:
# All the others are already stopped.
- # We don't call _Thread__stop() because it tries to acquire
- # thread._Thread__block which could also have been held while
- # we forked.
- thread._stopped = True
+ thread._stop()
_limbo.clear()
_active.clear()
diff --git a/Misc/NEWS b/Misc/NEWS
index 7dbaaff..95c8147 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -100,6 +100,9 @@ Library
- Issue #7502: Fix equality comparison for DocTestCase instances. Patch by
Cédric Krier.
+- Issue #11870: threading: Properly reinitialize threads internal locks and
+ condition variables to avoid deadlocks in child processes.
+
- Issue #8035: urllib: Fix a bug where the client could remain stuck after a
redirection or an error.