[pypy-commit] pypy py3.5: recreate the lock after forking, otherwise the state of the lock will not let the child progress

plan_rich pypy.commits at gmail.com
Fri Oct 14 04:22:35 EDT 2016


Author: Richard Plangger <planrichi at gmail.com>
Branch: py3.5
Changeset: r87769:bcb1215364e5
Date: 2016-10-14 10:19 +0200
http://bitbucket.org/pypy/pypy/changeset/bcb1215364e5/

Log:	recreate the lock after forking, otherwise the state of the lock
	will not let the child progress

diff --git a/pypy/module/thread/os_lock.py b/pypy/module/thread/os_lock.py
--- a/pypy/module/thread/os_lock.py
+++ b/pypy/module/thread/os_lock.py
@@ -153,13 +153,11 @@
     state is finalized (after it is untied from the interpreter).
 
     This is a private API for the threading module."""
-    # see issue 18808. We need to release this lock just before exiting
-    # the any thread!
+    # see issue 18808. We need to release this lock just before exiting any thread!
     ec = space.getexecutioncontext()
-    lock = ec._sentinel_lock
-    if lock is None:
-        lock = Lock(space)
-        ec._sentinel_lock = lock
+    # after forking the lock must be recreated! forget the old lock
+    lock = Lock(space)
+    ec._sentinel_lock = lock
     return space.wrap(lock)
 
 class W_RLock(W_Root):


More information about the pypy-commit mailing list