[pypy-svn] r46566 - in pypy/dist/pypy: module/thread translator/goal

arigo at codespeak.net arigo at codespeak.net
Fri Sep 14 10:37:10 CEST 2007


Author: arigo
Date: Fri Sep 14 10:37:10 2007
New Revision: 46566

Modified:
   pypy/dist/pypy/module/thread/gil.py
   pypy/dist/pypy/translator/goal/ann_override.py
Log:
We don't need this _annspecialcase_ any more.


Modified: pypy/dist/pypy/module/thread/gil.py
==============================================================================
--- pypy/dist/pypy/module/thread/gil.py	(original)
+++ pypy/dist/pypy/module/thread/gil.py	Fri Sep 14 10:37:10 2007
@@ -40,10 +40,10 @@
         """Notification that the current thread is between two bytecodes:
         release the GIL for a little while."""
         GIL = self.GIL
-        GIL.release()
-        # Other threads can run here
-        GIL.acquire(True)
-    yield_thread._annspecialcase_ = 'specialize:yield_thread'
+        # Other threads can run between the release() and the acquire().
+        # This is a single external function so that we are sure that nothing
+        # occurs between the release and the acquire, e.g. no GC operation.
+        GIL.fused_release_acquire()
 
     def getGIL(self):
         return self.GIL    # XXX temporary hack!

Modified: pypy/dist/pypy/translator/goal/ann_override.py
==============================================================================
--- pypy/dist/pypy/translator/goal/ann_override.py	(original)
+++ pypy/dist/pypy/translator/goal/ann_override.py	Fri Sep 14 10:37:10 2007
@@ -42,14 +42,6 @@
     #    clsdef = getbookkeeper().getuniqueclassdef(pycode.PyCode)
     #    return annmodel.SomeInstance(clsdef)    
 
-    def specialize__yield_thread(pol, funcdesc, args_s):
-        def yield_thread(self):
-            GIL = self.GIL
-            GIL.fused_release_acquire()
-        def builder(translator, func):
-            return translator.buildflowgraph(yield_thread)
-        return funcdesc.cachedgraph(None, builder=builder)
-
     def specialize__wrap(pol,  funcdesc, args_s):
         from pypy.interpreter.baseobjspace import Wrappable
         from pypy.annotation.classdef import ClassDef



More information about the Pypy-commit mailing list