[pypy-commit] pypy stacklet: Test and fix.
arigo
noreply at buildbot.pypy.org
Sun Aug 28 11:34:45 CEST 2011
Author: Armin Rigo <arigo at tunes.org>
Branch: stacklet
Changeset: r46856:6e9498e97d3d
Date: 2011-08-28 11:34 +0200
http://bitbucket.org/pypy/pypy/changeset/6e9498e97d3d/
Log: Test and fix.
diff --git a/pypy/rpython/memory/gctransform/shadowstack.py b/pypy/rpython/memory/gctransform/shadowstack.py
--- a/pypy/rpython/memory/gctransform/shadowstack.py
+++ b/pypy/rpython/memory/gctransform/shadowstack.py
@@ -162,7 +162,7 @@
# We are in the child process. Assumes that only the
# current thread survived, so frees the shadow stacks
# of all the other ones.
- gcdata.thread_stacks.clear()
+ gcdata.thread_stacks = None
# Finally, reset the stored thread IDs, in case it
# changed because of fork(). Also change the main
# thread to the current one (because there is not any
diff --git a/pypy/translator/c/test/test_standalone.py b/pypy/translator/c/test/test_standalone.py
--- a/pypy/translator/c/test/test_standalone.py
+++ b/pypy/translator/c/test/test_standalone.py
@@ -1019,6 +1019,27 @@
'5 ok']
+ def test_gc_with_fork_without_threads(self):
+ from pypy.rlib.objectmodel import invoke_around_extcall
+ if not hasattr(os, 'fork'):
+ py.test.skip("requires fork()")
+
+ def entry_point(argv):
+ childpid = os.fork()
+ if childpid == 0:
+ print "Testing..."
+ else:
+ pid, status = os.waitpid(childpid, 0)
+ assert pid == childpid
+ assert status == 0
+ print "OK."
+ return 0
+
+ t, cbuilder = self.compile(entry_point)
+ data = cbuilder.cmdexec('')
+ print repr(data)
+ assert data.startswith('Testing...\nOK.')
+
def test_thread_and_gc_with_fork(self):
# This checks that memory allocated for the shadow stacks of the
# other threads is really released when doing a fork() -- or at
More information about the pypy-commit
mailing list