[pypy-commit] pypy stmgc-c7: Fix

arigo noreply at buildbot.pypy.org
Thu Aug 7 20:45:11 CEST 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c7
Changeset: r72712:91f1b7951764
Date: 2014-08-07 18:01 +0200
http://bitbucket.org/pypy/pypy/changeset/91f1b7951764/

Log:	Fix

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
@@ -4,7 +4,7 @@
 XXX this module may contain near-duplicated code from the non-STM variants
 """
 
-from pypy.module.thread.threadlocals import BaseThreadLocals
+from pypy.module.thread.threadlocals import OSThreadLocals
 from pypy.module.thread.error import wrap_thread_error
 from pypy.interpreter.executioncontext import ExecutionContext
 from pypy.interpreter.gateway import W_Root, interp2app
@@ -42,7 +42,7 @@
         initialize_execution_context(ec)
 
 
-class STMThreadLocals(BaseThreadLocals):
+class STMThreadLocals(OSThreadLocals):
     threads_running = False
     _immutable_fields_ = ['threads_running?']
 
@@ -56,11 +56,9 @@
         assert space.actionflag.setcheckinterval_callback is None
         space.actionflag.setcheckinterval_callback = setcheckinterval_callback
 
-    def getallvalues(self):
-        raise ValueError
-
-    def leave_thread(self, space):
-        self.setvalue(None)
+    # XXX?
+    #def getallvalues(self):
+    #    raise ValueError
 
     def setup_threads(self, space):
         if not self.threads_running:
@@ -72,14 +70,6 @@
                               rstm.enter_callback_call,
                               rstm.leave_callback_call)
 
-    def reinit_threads(self, space):
-        self.setup_threads(space)
-        ident = rthread.get_ident()
-        if ident != self._mainthreadident:
-            ec = self.getvalue()
-            ec._signals_enabled += 1
-            self._mainthreadident = ident
-
     def configure_transaction_length(self, space):
         if self.threads_running:
             interval = space.actionflag.getcheckinterval()
diff --git a/pypy/module/thread/threadlocals.py b/pypy/module/thread/threadlocals.py
--- a/pypy/module/thread/threadlocals.py
+++ b/pypy/module/thread/threadlocals.py
@@ -7,33 +7,7 @@
 ExecutionContext._signals_enabled = 0     # default value
 
 
-class BaseThreadLocals(object):
-    _mainthreadident = 0
-
-    def initialize(self, space):
-        pass
-
-    def setup_threads(self, space):
-        pass
-
-    def signals_enabled(self):
-        ec = self.getvalue()
-        return ec._signals_enabled
-
-    def enable_signals(self, space):
-        ec = self.getvalue()
-        ec._signals_enabled += 1
-
-    def disable_signals(self, space):
-        ec = self.getvalue()
-        new = ec._signals_enabled - 1
-        if new < 0:
-            raise wrap_thread_error(space,
-                "cannot disable signals in thread not enabled for signals")
-        ec._signals_enabled = new
-
-
-class OSThreadLocals(BaseThreadLocals):
+class OSThreadLocals:
     """Thread-local storage for OS-level threads.
     For memory management, this version depends on explicit notification when
     a thread finishes.  This works as long as the thread was started by
@@ -49,6 +23,12 @@
         self._valuedict.clear()
         self._mainthreadident = 0
 
+    def initialize(self, space):
+        pass     # for the STMThreadLocals subclass
+
+    def setup_threads(self, space):
+        pass     # for the STMThreadLocals subclass
+
     def enter_thread(self, space):
         "Notification that the current thread is about to start running."
         self._set_ec(space.createexecutioncontext())


More information about the pypy-commit mailing list