[IPython-user] Killing a hung program

Fernando Perez Fernando.Perez at colorado.edu
Fri Jul 1 17:38:12 CDT 2005


Scott Kirkwood wrote:
> I did a little bit of experimenting with one of my programs. Trying to
> turn on signal handling didn't really work
> (signal.signal(signal.SIGINT, myBreak)), unless I'm outputting lots of
> text then it'll work.  But if I'm hung and there's no text, Ctrl-C
> doesn't work.
> 
> My thought is that you need to run the program in another thread and
> then try sending signals to it. If the signals to stop doesn't work
> you just kill the thread and hope for the best.

Won't work.  Cross-thread signal handling is simply NOT supported in python, 
at all.  Neither can threads be killed in python.  I've done a lot of reading 
on those two questions, since ipython has multithreaded support, and Tim 
Peters' posts on the issue leave no room for doubt (or hope).

best,
f




More information about the IPython-user mailing list