1# test basic capability to start a new thread 2# 3# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd 4 5try: 6 import utime as time 7except ImportError: 8 import time 9import _thread 10 11 12def foo(): 13 pass 14 15 16def thread_entry(n): 17 for i in range(n): 18 foo() 19 20 21_thread.start_new_thread(thread_entry, (10,)) 22_thread.start_new_thread(thread_entry, (20,)) 23 24# wait for threads to finish 25time.sleep(1) 26print("done") 27