简体   繁体   English

pykd 无法在 python 脚本中启动线程使用线程

[英]pykd can not start thread use threading in python script

when I use threading.Thread to create new thread.it can not start.当我使用 threading.Thread 创建新线程时,它无法启动。 The code like this像这样的代码

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()

When I run this code.当我运行这段代码时。 The windbg will not report error 、not print any thing and never return enter image description here windbg 不会报告错误、不会打印任何东西并且永远不会返回在这里输入图像描述

I will to create new thread to run something我将创建新线程来运行某些东西

Don't use 'threading' within windbg.不要在 windbg 中使用“线程”。 Windbg has own multithreading model and loop of debug events. Windbg 拥有自己的多线程 model 和调试事件循环。 It is near impossible to run all this threads together without bugs.几乎不可能在没有错误的情况下同时运行所有这些线程。

In fact I dont't recomend to use 'threading' also in standalone python program with pykd module.事实上,我不建议在带有 pykd 模块的独立 python 程序中也使用“线程”。 All my scripts always use 'multiprocessing' module.我所有的脚本总是使用“多处理”模块。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM