frank@rsoft.UUCP (Frank I. Reiter) (03/29/89)
I have a small monitoring program which uses curses to update it's display every 15 seconds. It has been in use and worked fine for a couple of years with one exception: It appears that sometimes it returns from an exit! SIGINT is set to be handled by this routine: void quit() { signalson(NO); /* Leave us alone while we cleanup */ close(sysfd); clear(); refresh(); endwin(); detachutil(); /* Log us out of shared memory */ puts("watch: terminated"); exit(0); } signalson(flag) /* Enable/disable sig handling routines */ int flag; { int i; static int lastflag=YES; if(flag==YES) { signal(SIGINT,quit); signal(SIGTERM,quit); } else { signal(SIGINT,SIG_IGN); signal(SIGTERM,SIG_IGN); } i=lastflag; lastflag=flag; return(i); } When the interrupt key is sent to the process sometimes the screen will clear, the exit message will be printed, and then a few seconds later the screen is refreshed with the latest statistics. After that happens the interrupt key is ignored and we must use SIGQUIT to kill the process. Can anybody suggest why this might be happening? -- _____________________________________________________________________________ Frank I. Reiter UUCP: {uunet,ubc-cs}!van-bc!rsoft!frank Reiter Software Inc. frank@rsoft.bc.ca, a2@mindlink.UUCP Langley, British Columbia BBS: Mind Link @ (604)533-2312, login as Guest