[comp.sys.ibm.pc] SIGINT question

ross@isis.UUCP (Ross McConnell) (09/04/87)

 I am using signal() in a MSC4.0 program, to catch CTRL-C - everything
works fine. However, parts of the program consist of lengthy math
routines, and the response to the CTRL-C can be quite slow (5-10
seconds). I believe that this occurs because DOS only checks for
CTRL-C while making BIOS calls. Is this true? If so, what is a good
way around it. Make "dummy" BIOS calls in the math routines? Any
suggestions would be appreciated.

martyl@rocksvax.UUCP (Marty Leisner) (09/08/87)

In article <1930@isis.UUCP> ross@isis.UUCP (Ross McConnell) writes:
>
> I am using signal() in a MSC4.0 program, to catch CTRL-C - everything
>works fine. However, parts of the program consist of lengthy math
>routines, and the response to the CTRL-C can be quite slow (5-10
>seconds). I believe that this occurs because DOS only checks for
>CTRL-C while making BIOS calls. Is this true? If so, what is a good
>way around it. Make "dummy" BIOS calls in the math routines? Any
>suggestions would be appreciated.


I believe it will only catch control C on disk io unless you have break
on.  

I wrote a com port driver which I use for my console.  If the character 
received is a cntl-C, I immediately issue a call to interrupt 1BH (the
BIOS cntl-c handler).  It appears to work a little better than when I 
run on the console with the standard supplied IBM stuff
(it seems cntl-Cs are only checked as the DOS fetches
characters from the type-ahead queue).  If the program isn't catching
CNTL-Cs, it has the funny side effect of just printing  cntl-C on the screen --
at least I can tell the system is alive.

A reasonable way to handle the problem may be to write a TSR to look for
CNTL-Cs and if the program currently isn't in DOS, immediately do a far
call to the CNTL-C handler defined in the programs PSP.

I'm also looking for a way to abort a currently running program -- the 
above strategy should work for a special "hot key" which "aborts the current
process".  Any ideas on this?  Anyone have this toy?  (I'm tired of rebooting
when debugging software).

marty