[pypy-commit] lang-smalltalk default: Spinlock as RThread_Lock replacement. Continuation of parent thread still not working.

amintos noreply at buildbot.pypy.org
Thu Apr 3 11:31:09 CEST 2014


Author: amintos
Branch: 
Changeset: r742:d6f88032bd75
Date: 2014-01-06 15:15 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/d6f88032bd75/

Log:	Spinlock as RThread_Lock replacement. Continuation of parent thread
	still not working.

diff --git a/spyvm/interpreter.py b/spyvm/interpreter.py
--- a/spyvm/interpreter.py
+++ b/spyvm/interpreter.py
@@ -37,6 +37,7 @@
 
     def __init__(self):
         #self.lock = rthread.allocate_lock()
+        self.lock = 0
 
         # critical values, only modify under lock:
         self.interp = None
@@ -46,6 +47,11 @@
     # wait for previous thread to start, then set global state
     def acquire(interp, w_frame):
         #bootstrapper.lock.acquire(True)
+        while bootstrapper.lock:
+            rstm.should_break_transaction()
+            rstm.jit_stm_transaction_break_point(True)
+        bootstrapper.lock = 1
+
         bootstrapper.interp = interp
         bootstrapper.w_frame = w_frame
 
@@ -56,6 +62,7 @@
         bootstrapper.interp = None
         bootstrapper.w_frame = None
         #bootstrapper.lock.release()
+        bootstrapper.lock = 0
 
     release = staticmethod(release)
 
@@ -65,8 +72,8 @@
         #rthread.gc_thread_start()
         interp = bootstrapper.interp
         w_frame = bootstrapper.w_frame
-        assert isinstance(interp, Interpreter)
-        assert isinstance(w_frame, model.W_PointersObject)
+        assert isinstance(interp, Interpreter), "Race-condition exploded!"
+        assert isinstance(w_frame, model.W_PointersObject), "Race-condition exploded!"
         bootstrapper.num_threads += 1
         bootstrapper.release()
 


More information about the pypy-commit mailing list