[Tutor] How to deal with a thread that doesn't terminate
Michael Langford
mlangford.cs03 at gtalumni.org
Wed Feb 20 08:23:11 CET 2008
Instead of using a thread, you could see if you could use a second
process. For instance, the following would work on windows (and is
killable).
import subprocess
import win32api
class SpawnController(object):
def __init__(self,cmd):
self.cmdline = cmd
def start(self):
self.process = subprocess.Popen([self.cmdline])
def stop(self):
win32api.TerminateProcess(int(self.process._handle), -1
--michael
On Feb 19, 2008 4:53 PM, Tony Cappellini <cappy2112 at gmail.com> wrote:
> When I executing a program external to the main program in a thread,
> and that thread hangs, can the thread be terminated?
> How does one handle this situation?
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
--
Michael Langford
Phone: 404-386-0495
Consulting: http://www.RowdyLabs.com
More information about the Tutor
mailing list