我发现自己可以import _thread,这让我对opemmv多线程有了大胆的想法...
但是没法正常使用
我的代码:
import _thread
import time
def th_func(delay, id):
while True:
time.sleep(delay)
print('Running thread %d' % id)
for i in range(2):
_thread.start_new_thread(th_func, (i + 1, i))
在SPYDER
Running thread 0
Running thread 1
Running thread 0
Running thread 0
Running thread 1
在OPENMV IDE
>>> MicroPython v1.12-omv-r1 OpenMV v3.6.9 2020-10-12; OPENMV3-STM32F765
Type "help()" for more information.
所以,究竟支持多线程吗?
如果现在不支持,请问为什么可以import _thread?
如果现在支持,请问为什么会报错呢?