marc nicole
2024-09-25 17:24:49 UTC
Hello guys,
I want to know how to kill a specific running thread (say by its id)
for now I run and kill a thread like the following:
# start thread
thread1 = threading.Thread(target= self.some_func(), args=( ...,), )
thread1.start()
# kill the thread
event_thread1 = threading.Event()
event_thread1.set()
I know that set() will kill all running threads, but if there was thread2
as well and I want to kill only thread1?
Thanks!
I want to know how to kill a specific running thread (say by its id)
for now I run and kill a thread like the following:
# start thread
thread1 = threading.Thread(target= self.some_func(), args=( ...,), )
thread1.start()
# kill the thread
event_thread1 = threading.Event()
event_thread1.set()
I know that set() will kill all running threads, but if there was thread2
as well and I want to kill only thread1?
Thanks!