Mail Archives: djgpp/1997/01/04/14:01:48
Andreas Vernersson wrote:
>
> I've programmed a timer-interrupt (int 0x1c) and it works fine, but
> if i terminate my program with Ctrl-C when the timer is installed
> the computer hung. I think this is caused because i dont't reinstall
> the old interrupt and my timer-interrupt is still there when the program
> tries to exit. So, how do i change the signal caused by Ctrl-C to
> restore the real timer interrupt before exiting. Hm.. And hum..
> how do i make the usual "core dump" appear in the new signal before
> exiting?
Well, to trap Ctrl-C, just install a signal handler for SIGINT like so:
void my_handler( int sig );
{
...
}
signal( SIGINT, my_handler );
Your signal handler can then take care of restoring interrupts,
deallocating DOS memory, etc. As far as getting a traceback printed,
there was a big discussion a while back about how to do it, but I don't
remember the details. I'm sure somebody does though. :)
--
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I | fighteer AT cs DOT com |
| Call me for your free AOL disk! | http://www.cs.com/fighteer |
| Chain letters, work-at-home schemes, free long distance, etc., |
| are ILLEGAL! Keep the Internet litter-free... don't SPAM. |
---------------------------------------------------------------------
- Raw text -