[pypy-commit] pypy default: try to clean up more on fork
bdkearns
noreply at buildbot.pypy.org
Sat Feb 16 10:31:36 CET 2013
Author: Brian Kearns <bdkearns at gmail.com>
Branch:
Changeset: r61309:8f52d162f0ee
Date: 2013-02-16 04:27 -0500
http://bitbucket.org/pypy/pypy/changeset/8f52d162f0ee/
Log: try to clean up more on fork
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
@@ -85,9 +85,11 @@
# enable_signals() if necessary. That's a hack but I cannot
# figure out a non-hackish way to handle thread+signal+fork :-(
ident = rthread.get_ident()
- old = self._signalsenabled.get(ident, 0)
- if ident is not self._mainthreadident:
- self._mainthreadident = ident
- old += 1
- self._signalsenabled.clear()
- self._signalsenabled[ident] = old
+ val = self.getvalue()
+ sig = self._signalsenabled.get(ident, 0)
+ if ident != self._mainthreadident:
+ sig += 1
+ self._cleanup_()
+ self.setvalue(val)
+ self._signalsenabled[ident] = sig
+ self._mainthreadident = ident
More information about the pypy-commit
mailing list