[pypy-svn] r46362 - pypy/dist/pypy/module/thread/test

arigo at codespeak.net arigo at codespeak.net
Thu Sep 6 10:05:04 CEST 2007


Author: arigo
Date: Thu Sep  6 10:05:02 2007
New Revision: 46362

Modified:
   pypy/dist/pypy/module/thread/test/support.py
Log:
The app-level time.sleep() doesn't release the GIL, and
there is little chance that we'll fix it when running on
top of py.py.  Simple workaround.


Modified: pypy/dist/pypy/module/thread/test/support.py
==============================================================================
--- pypy/dist/pypy/module/thread/test/support.py	(original)
+++ pypy/dist/pypy/module/thread/test/support.py	Thu Sep  6 10:05:02 2007
@@ -7,11 +7,13 @@
 NORMAL_TIMEOUT = 300.0   # 5 minutes
 
 def waitfor(space, w_condition, delay=1):
-    w_sleep = space.appexec([], "():\n import time; return time.sleep")
     adaptivedelay = 0.04
     limit = time.time() + delay * NORMAL_TIMEOUT
     while time.time() <= limit:
-        space.call_function(w_sleep, space.wrap(adaptivedelay))
+        GIL = space.threadlocals.GIL
+        GIL.release()
+        time.sleep(adaptivedelay)
+        GIL.acquire(True)
         gc.collect()
         if space.is_true(space.call_function(w_condition)):
             return



More information about the Pypy-commit mailing list