[IPython-dev] Zmq Terminal.
epatters at enthought.com
Wed May 25 14:05:34 EDT 2011
On May 25, 2011, at 12:24 PM, Thomas Kluyver wrote:
> On 25 May 2011 18:07, Evan Patterson <epatters at enthought.com> wrote:
> The way interrupts work in the Qt console (in Unix) is precisely that, though: the frontend process sends a SIGINT signal to the kernel. The expectation is that the kernel will handle the signal in a reasonable way. We could try to devise some other scheme, like I did for Windows, but it would be difficult to get right. The kernel should just do the right thing.
> That only applies while something is being executed, though (looking at the code, it checks self._executing). We can do the equivalent and call interrupt_kernel from the terminal frontend. The problem is that the kernel gets the SIGINT straight from the user, wherever it is in the code. In particular, if the user presses Ctrl-C at an input prompt, that shows up while the kernel is idling. We could catch it, but I feel that the right way to do it is to insulate the kernel from the user's keystrokes.
But this is not robust. Frontends use SIGINT signals to tell to the kernel that it should it interrupt its execution. There is no guarantee that they will be polite about it, i.e. only send SIGINT when the kernel is actually executing. In fact, in the general case (where multiple frontends are connected to the same kernel), there is no way to even know whether the kernel is executing.
I think it is good principle to ensure that the kernel is as robust as possible to misbehaving clients. This means that it should be prepared to handle SIGINT at any time.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-dev