[comp.lang.c] MSC 4.0 interrupt

creps@silver.bacs.indiana.edu (Steve Creps) (01/28/88)

   I'm trying to get an interrupt handler to work in MSC 4.0 that will
handle ^C's at any time. The manual isn't a lot of help, giving only
one example with the signal routine. I wrote a test program which is
basically for(i=1;i<100000;i++) if (i % 10000 == 0) fprintf("%d",i);
and it seems to work, except that it waits until it's ready to print the
next number before calling the interrupt routine. However, it does seem
as if it is storing the interrupt until output is done, and not just
waiting until the output before it even recognizes the interrupt.
My interrupt routine was something like
int interrupt()
{
	fprintf("*** int ***");
	signal(SIGINT,interrupt);
	return;
}
   I don't think it was a problem with declarations, since I'm following
the example in the manual. Anyway, that was the program that seemed to
(pretty much) work. 
   In the actual, large program I'm working on, I have things declared the
same way, but I can't get it to recognize the ^C. Actually, sometimes it
will, but only if I hit ^C and/or ^<Brk> about a hundred or more times real
fast. Even though output is being done quite a bit, it still doesn't seem
to push (or queue, whatever) the interrupt. Actually, I don't even want it
to have to wait for output to process the interrupt, but even that would be
a step in the right direction.
   By the way, I AM initializing it with signal(SIGINT, interrupt); so that's
not it.
   Any help on this would be greatly appreciated.

-	-	-	-	-	-	-	-	-
Steve Creps on the VAX 8650 running Ultrix 2.0-1 at Indiana University.
creps@silver.bacs.indiana.edu, ...iuvax!silver!creps, creps@iubacs.bitnet