[pypy-commit] pypy stm-thread: Translation fixes

arigo noreply at buildbot.pypy.org
Wed Jun 6 19:53:01 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: stm-thread
Changeset: r55445:54154cef301d
Date: 2012-06-06 19:49 +0200
http://bitbucket.org/pypy/pypy/changeset/54154cef301d/

Log:	Translation fixes

diff --git a/pypy/interpreter/executioncontext.py b/pypy/interpreter/executioncontext.py
--- a/pypy/interpreter/executioncontext.py
+++ b/pypy/interpreter/executioncontext.py
@@ -326,6 +326,7 @@
         # but actually *forces* another thread to run whenever the counter
         # reaches zero.
         self.checkinterval_scaled = 10000 * TICK_COUNTER_STEP
+        self.setcheckinterval_callback = None
         self._rebuild_action_dispatcher()
 
     def fire(self, action):
@@ -365,6 +366,8 @@
             interval = MAX
         self.checkinterval_scaled = interval * TICK_COUNTER_STEP
         self.reset_ticker(-1)
+        if self.setcheckinterval_callback is not None:
+            self.setcheckinterval_callback()
 
     def _rebuild_action_dispatcher(self):
         periodic_actions = unrolling_iterable(self._periodic_actions)
diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -90,6 +90,7 @@
 
     def _runs_normal_handler(self):
         if self.space.config.translation.stm and we_are_translated():
+            from pypy.rlib import rstm
             return not rstm.should_break_transaction()
         return True
 
diff --git a/pypy/module/thread/stm.py b/pypy/module/thread/stm.py
--- a/pypy/module/thread/stm.py
+++ b/pypy/module/thread/stm.py
@@ -16,12 +16,11 @@
         """NOT_RPYTHON: set up a mechanism to send to the C code the value
         set by space.actionflag.setcheckinterval()."""
         #
-        def setcheckinterval1(interval):
-            old_setcheckinterval(space.actionflag, interval)
+        def setcheckinterval_callback():
             self.configure_transaction_length(space)
         #
-        old_setcheckinterval = space.actionflag.__class__.setcheckinterval
-        space.actionflag.setcheckinterval = setcheckinterval1
+        assert space.actionflag.setcheckinterval_callback is None
+        space.actionflag.setcheckinterval_callback = setcheckinterval_callback
         self.threads_running = False
 
     def setup_threads(self, space):


More information about the pypy-commit mailing list