Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 42 |
Nodes: | 6 (0 / 6) |
Uptime: | 00:16:10 |
Calls: | 220 |
Calls today: | 1 |
Files: | 824 |
Messages: | 121,481 |
Posted today: | 6 |
I want to know how to kill a specific running thread (say by its id)
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?
Killing or stopping a thread can cause data corruption and
unpredictable behavior.
How to create a per-thread event in Python 2.7?