Bill Allombert on Tue, 06 Dec 2005 21:17:49 +0100

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

Re: handling interrupt

On Mon, Dec 05, 2005 at 04:24:10PM -0800, Ilya Zakharevich wrote:
> 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

I had the same idea, but it does not work for me (on GNU/Linux).

The system(3) man page states that:
    system()  executes a command specified in command by calling /bin/sh -c
    command, and returns after the command has been completed.  During exe-
    cution  of the command, SIGCHLD will be blocked, and SIGINT and SIGQUIT
    will be ignored.

So it is not better here than typing ^C and hoping that does not happen
during the call to system(3).

According to the very usefull FreeBSD manpages database 
<>, all BSD based systems have
the same behaviour. The SunOS 5.9 manpage is unclear on this point.