Browse Source

tests/thread: Add a test to stress concurrent globals access.

Signed-off-by: Damien George <damien@micropython.org>
pull/11604/head
Damien George 9 months ago
parent
commit
d5a023bc26
  1. 79
      tests/thread/stress_globals.py

79
tests/thread/stress_globals.py

@ -0,0 +1,79 @@
import time, _thread
def thread_task():
for _ in range(1000):
a00
print("pass")
print("start")
a00 = None
_thread.start_new_thread(thread_task, ())
# create lots of global variables
a01 = None
a02 = None
a03 = None
a04 = None
a05 = None
a06 = None
a07 = None
a10 = None
a11 = None
a12 = None
a13 = None
a14 = None
a15 = None
a16 = None
a17 = None
a18 = None
a19 = None
a20 = None
a21 = None
a22 = None
a23 = None
a24 = None
a25 = None
a26 = None
a27 = None
a28 = None
a29 = None
a30 = None
a31 = None
a32 = None
a33 = None
a34 = None
a35 = None
a36 = None
a37 = None
a38 = None
a39 = None
a40 = None
a41 = None
a42 = None
a43 = None
a44 = None
a45 = None
a46 = None
a47 = None
a48 = None
a49 = None
a50 = None
a51 = None
a52 = None
a53 = None
a54 = None
a55 = None
a56 = None
a57 = None
a58 = None
a59 = None
a60 = None
a61 = None
a62 = None
a63 = None
# let the thread finish
time.sleep(0.1)
Loading…
Cancel
Save