[pypy-commit] pypy stmgc-c7: Temporary workaround: start a new transaction around a lock.release()

arigo noreply at buildbot.pypy.org
Tue Mar 17 20:06:43 CET 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c7
Changeset: r76438:7b2e2b3f44f0
Date: 2015-03-17 19:00 +0100
http://bitbucket.org/pypy/pypy/changeset/7b2e2b3f44f0/

Log:	Temporary workaround: start a new transaction around a
	lock.release()

diff --git a/rpython/rlib/rthread.py b/rpython/rlib/rthread.py
--- a/rpython/rlib/rthread.py
+++ b/rpython/rlib/rthread.py
@@ -61,6 +61,9 @@
 c_thread_releaselock = llexternal('RPyThreadReleaseLock', [TLOCKP],
                                   lltype.Signed,
                                   _nowrapper=True)   # *don't* release the GIL
+c_thread_releaselock_GIL = llexternal('RPyThreadReleaseLock', [TLOCKP],
+                                      lltype.Signed,
+                                      releasegil=True)
 
 # another set of functions, this time in versions that don't cause the
 # GIL to be released.  Used to be there to handle the GIL lock itself,
@@ -158,7 +161,11 @@
         return res
 
     def release(self):
-        if c_thread_releaselock(self._lock) != 0:
+        if rgc.stm_is_enabled():
+            func = c_thread_releaselock_GIL   # XXX temporary workaround!
+        else:
+            func = c_thread_releaselock
+        if func(self._lock) != 0:
             raise error("the lock was not previously acquired")
 
     def __del__(self):


More information about the pypy-commit mailing list