[pypy-svn] pypy default: After much thinking, add a condition. Really hard to test :-(

arigo commits-noreply at bitbucket.org
Wed Feb 2 16:33:38 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r41568:dd6382d7a599
Date: 2011-02-01 16:43 +0100
http://bitbucket.org/pypy/pypy/changeset/dd6382d7a599/

Log:	After much thinking, add a condition. Really hard to test :-(

diff --git a/pypy/rpython/memory/gctransform/framework.py b/pypy/rpython/memory/gctransform/framework.py
--- a/pypy/rpython/memory/gctransform/framework.py
+++ b/pypy/rpython/memory/gctransform/framework.py
@@ -1406,6 +1406,9 @@
             occur in this thread.
             """
             aid = get_aid()
+            if aid == gcdata.main_thread:
+                return   # ignore calls to thread_die() in the main thread
+                         # (which can occur after a fork()).
             gcdata.thread_stacks.setitem(aid, llmemory.NULL)
             old = gcdata.root_stack_base
             if gcdata._fresh_rootstack == llmemory.NULL:
@@ -1486,7 +1489,9 @@
                 # the next call to save_away_current_stack()).
                 gcdata.thread_stacks.clear()
                 # Finally, reset the stored thread IDs, in case it
-                # changed because of fork().
+                # changed because of fork().  Also change the main
+                # thread to the current one (because there is not any
+                # other left).
                 aid = get_aid()
                 gcdata.main_thread = aid
                 gcdata.active_thread = aid


More information about the Pypy-commit mailing list