简体   繁体   中英

pykd can not start thread use threading in python script

when I use threading.Thread to create new thread.it can not start. 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

I will to create new thread to run something

Don't use 'threading' within windbg. Windbg has own multithreading model and loop of debug events. 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. All my scripts always use 'multiprocessing' module.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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