Author: Remi Meier <[email protected]>
Branch: stmgc-c8
Changeset: r85650:8c9fbb5b5f31
Date: 2016-07-11 09:09 +0200
http://bitbucket.org/pypy/pypy/changeset/8c9fbb5b5f31/

Log:    protect setting the execution context threadlocal with inevitable

        Seems to fix a crash where the threadlocal was corrupted. If not
        setting the TL in an inevitable TX, the superclass' try_enter_thread
        would not re-set the EC after an abort. Instead, it would detect
        that the TL already has a value and probably reuse it in multiple
        threads.

diff --git a/pypy/module/pypystm/threadlocals.py 
b/pypy/module/pypystm/threadlocals.py
--- a/pypy/module/pypystm/threadlocals.py
+++ b/pypy/module/pypystm/threadlocals.py
@@ -42,6 +42,11 @@
             interval = space.actionflag.getcheckinterval()
             rstm.set_transaction_length(interval / 10000.0)
 
+    def _set_ec(self, ec, register_in_valuedict=True):
+        # must turn inevitable, for raw_thread_local.set(ec)
+        rstm.become_inevitable()
+        OSThreadLocals._set_ec(self, ec, register_in_valuedict)
+
     def leave_thread(self, space):
         # must turn inevitable, for raw_thread_local.set(None)
         rstm.become_inevitable()
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to