[pypy-commit] pypy gil-improvement: Force the GIL to be released in this app-test; time.sleep()

arigo noreply at buildbot.pypy.org
Sat Oct 1 10:36:48 CEST 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: gil-improvement
Changeset: r47740:3e1481231b00
Date: 2011-10-01 10:36 +0200
http://bitbucket.org/pypy/pypy/changeset/3e1481231b00/

Log:	Force the GIL to be released in this app-test; time.sleep() doesn't
	do it when non-translated... It likely worked because
	sys.checkinterval used to be only 100.

diff --git a/pypy/module/thread/test/test_thread.py b/pypy/module/thread/test/test_thread.py
--- a/pypy/module/thread/test/test_thread.py
+++ b/pypy/module/thread/test/test_thread.py
@@ -225,7 +225,8 @@
 
         def busy_wait():
             for x in range(1000):
-                time.sleep(0.01)
+                print 'tick...', x  # <-force the GIL to be released, as
+                time.sleep(0.01)    #   time.sleep doesn't do non-translated
 
         # This is normally called by app_main.py
         signal.signal(signal.SIGINT, signal.default_int_handler)


More information about the pypy-commit mailing list