当我使用threading.Thread创建新的thread.it时,无法启动。像这样的代码
import threading
import time
import sys
def worker():
count = 1
while True:
if count >= 6:
break
time.sleep(1)
count += 1
print("thread name = {}, thread id = {}".format(threading.current_thread().name,threading.current_thread().ident))
t1 = threading.Thread(target=worker,name="t1")
t2 = threading.Thread(target=worker,name='t2')
t1.start()
t2.start()
t1.join()
t2.join()当我运行这段代码时。风车不会报告错误,、不会打印任何东西,也不会返回、。
我将创建新线程来运行
发布于 2022-11-28 17:02:43
不要在风中使用“线程”。Windbg有自己的多线程模型和调试事件的循环。几乎不可能在没有bug的情况下将所有这些线程一起运行。
事实上,我不建议使用‘线程’,也在独立的python程序中使用pykd模块。我所有的脚本都使用“多处理”模块。
https://stackoverflow.com/questions/74589129
复制相似问题