[pypy-commit] pypy stmgc-c8: protect setting the execution context threadlocal with inevitable
Raemi
pypy.commits at gmail.com
Mon Jul 11 03:10:36 EDT 2016
Author: Remi Meier <remi.meier at gmail.com>
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()
More information about the pypy-commit
mailing list