How to force a thread to stop
Hans
NoSpam at Hccnet.nl
Sat Jul 22 08:47:30 EDT 2006
Hi all,
Is there a way that the program that created and started a thread also stops
it.
(My usage is a time-out).
E.g.
thread = threading.Thread(target=Loop.testLoop)
thread.start() # This thread is expected to finish within a second
thread.join(2) # Or time.sleep(2) ?
if thread.isAlive():
# thread has probably encountered a problem and hangs
# What should be here to stop thread ??????
Note that I don't want to change the target (too much), as many possible
targets exist,
together thousands of lines of code.
Thanks,
Hans
More information about the Python-list
mailing list