tests/thread: Allow some tests to run on ports with not much heap.

uheapq-ticks
Damien George 2016-05-31 17:36:06 +01:00
parent 63d05228a3
commit 8b9ddf4031
3 changed files with 5 additions and 3 deletions

View File

@ -26,10 +26,11 @@ def th(n, lo, hi):
lock = _thread.allocate_lock()
n_thread = 4
n_finished = 0
n_repeat = 4 # use 40 for more stressful test (uses more heap)
# spawn threads
for i in range(n_thread):
_thread.start_new_thread(th, (40, i * 256 // n_thread, (i + 1) * 256 // n_thread))
_thread.start_new_thread(th, (n_repeat, i * 256 // n_thread, (i + 1) * 256 // n_thread))
# busy wait for threads to finish
while n_finished < n_thread:

View File

@ -25,7 +25,7 @@ def th(n, lo, hi):
lock = _thread.allocate_lock()
n_repeat = 30
n_range = 300
n_range = 50 # 300 for stressful test (uses more heap)
n_thread = 4
n_finished = 0

View File

@ -22,10 +22,11 @@ def th(base, n):
lock = _thread.allocate_lock()
n_thread = 4
n_finished = 0
n_qstr_per_thread = 100 # make 1000 for a more stressful test (uses more heap)
# spawn threads
for i in range(n_thread):
_thread.start_new_thread(th, (i * 1000, 1000))
_thread.start_new_thread(th, (i * n_qstr_per_thread, n_qstr_per_thread))
# busy wait for threads to finish
while n_finished < n_thread: