summaryrefslogtreecommitdiff
path: root/tests/thread/stress_schedule.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/thread/stress_schedule.py')
-rw-r--r--tests/thread/stress_schedule.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/thread/stress_schedule.py b/tests/thread/stress_schedule.py
index c5a402b3a..8be7f2d73 100644
--- a/tests/thread/stress_schedule.py
+++ b/tests/thread/stress_schedule.py
@@ -14,7 +14,11 @@ except AttributeError:
gc.disable()
+_NUM_TASKS = 10000
+_TIMEOUT_MS = 10000
+
n = 0 # How many times the task successfully ran.
+t = None # Start time of test, assigned here to preallocate entry in globals dict.
def task(x):
@@ -34,9 +38,6 @@ def thread():
for i in range(8):
_thread.start_new_thread(thread, ())
-_NUM_TASKS = const(10000)
-_TIMEOUT_MS = const(10000)
-
# Wait up to 10 seconds for 10000 tasks to be scheduled.
t = utime.ticks_ms()
while n < _NUM_TASKS and utime.ticks_diff(utime.ticks_ms(), t) < _TIMEOUT_MS: