We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2847d74 commit 06a12adCopy full SHA for 06a12ad
1 file changed
tests/thread/stress_create.py
@@ -0,0 +1,22 @@
1
+# stress test for creating many threads
2
+
3
+try:
4
+ import utime as time
5
+except ImportError:
6
+ import time
7
+import _thread
8
9
+def thread_entry(n):
10
+ pass
11
12
+thread_num = 0
13
+while thread_num < 500:
14
+ try:
15
+ _thread.start_new_thread(thread_entry, (thread_num,))
16
+ thread_num += 1
17
+ except MemoryError:
18
19
20
+# wait for the last threads to terminate
21
+time.sleep(1)
22
+print('done')
0 commit comments