pykd can not start thread use threading in python script

83 Views Asked by At

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

1

There are 1 best solutions below

0
ussrhero On BEST ANSWER

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.