1 Star 0 Fork 11

刘荣福/microPython

forked from QuecPython/microPython 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
thread_start2.py 633 Bytes
一键复制 编辑 原始数据 按行查看 历史
chenchi 提交于 2021-06-03 16:44 +08:00 . first commit
# test capability to start a thread with keyword args
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
try:
import utime as time
except ImportError:
import time
import _thread
def thread_entry(a0, a1, a2, a3):
print("thread", a0, a1, a2, a3)
# spawn thread using kw args
_thread.start_new_thread(thread_entry, (10, 20), {"a2": 0, "a3": 1})
# wait for thread to finish
time.sleep(1)
# incorrect argument where dictionary is needed for keyword args
try:
_thread.start_new_thread(thread_entry, (), ())
except TypeError:
print("TypeError")
print("done")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/oi-lrf/microPython.git
git@gitee.com:oi-lrf/microPython.git
oi-lrf
microPython
microPython
master

搜索帮助