Author: Brian Kearns <[email protected]>
Branch:
Changeset: r60510:943dfd91fc9d
Date: 2013-01-26 14:55 -0500
http://bitbucket.org/pypy/pypy/changeset/943dfd91fc9d/
Log: fix untranslated test_interrupt_main by making sure we don't
interrupt too early
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
@@ -220,17 +220,24 @@
import signal
def f():
- time.sleep(0.5)
- thread.interrupt_main()
+ for x in range(50):
+ if waiting:
+ thread.interrupt_main()
+ return
+ print 'tock...', x # <-force the GIL to be released, as
+ time.sleep(0.01) # time.sleep doesn't do non-translated
def busy_wait():
- for x in range(1000):
+ waiting.append(None)
+ for x in range(100):
print 'tick...', x # <-force the GIL to be released, as
time.sleep(0.01) # time.sleep doesn't do non-translated
+ waiting.pop()
# This is normally called by app_main.py
signal.signal(signal.SIGINT, signal.default_int_handler)
for i in range(100):
+ waiting = []
thread.start_new_thread(f, ())
raises(KeyboardInterrupt, busy_wait)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit