Ilya Zakharevich on Tue, 06 Dec 2005 23:25:36 +0100


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

Re: handling interrupt


On Tue, Dec 06, 2005 at 09:03:06PM +0100, Bill Allombert wrote:
> > ???  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

Obviously, this part is system-specific...

>     , 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.

... and this is why no sane program uses the system() system call;
they write the call to shell explicitly.  I did not know that GP/PARI
translates its system() directly to system(3)...

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

The only quick solution I see is to catch SIGUSR1 and do as for SIGINT...

Hope this helps,
Ilya