Author: Armin Rigo <[email protected]>
Branch:
Changeset: r66902:5468ee20e516
Date: 2013-09-11 14:12 +0200
http://bitbucket.org/pypy/pypy/changeset/5468ee20e516/
Log: Force waiting until most threads have finished. It was the cause of
intermittent failures in test_interrupt_main(), which could not
create any new thread.
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
@@ -187,9 +187,12 @@
skip("this OS supports too many threads to check (> 1000)")
lock = thread.allocate_lock()
lock.acquire()
+ count = [0]
def f():
+ count[0] += 1
lock.acquire()
lock.release()
+ count[0] -= 1
try:
try:
for i in range(1000):
@@ -197,11 +200,15 @@
finally:
lock.release()
# wait a bit to allow most threads to finish now
- self.busywait(2.0)
+ while count[0] > 10:
+ print count[0] # <- releases the GIL
+ print "ok."
except (thread.error, MemoryError):
pass
else:
raise Exception("could unexpectedly start 1000 threads")
+ # safety: check that we can start a new thread here
+ thread.start_new_thread(lambda: None, ())
def test_stack_size(self):
import thread
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit