Ilya Zakharevich on Tue, 06 Dec 2005 01:30:56 +0100

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: hangling interrupt

On Mon, Dec 05, 2005 at 04:40:09PM -0500, Igor Schein wrote:
> Hi,
> Don't try this in a gp session you care about:
> k=0;while(k++,print(k);system("sleep 1"))
> Now that's what I call a true infinite loop, the one you cannot break
> out of.

???  kill -INT $GP_PID

> Even ^\ doesn't work, only ^Z and good-bye session.  I have a
> feeling it's non-trivial to handle this scenario properly.

You mean "handle from GP/PARI"?  system() will return the reason for
subprocess to terminate (provided the shell propagates this info to
the caller; most do: if the kid of a shell was terminated by SIGn, the
shell return code is typically 0x80 | n).

If system() says that the kid was terminated by SIGINT/SIGQUIT, then
PARI can query some handler; GP may install a handler to ask the user
whether they want to emulate SIGINT obtained by GP/PARI.

Hope this helps,