www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/04/14:01:48

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Signal
Date: Sat, 04 Jan 1997 12:07:57 -0800
Organization: Two pounds of chaos and a pinch of salt
Lines: 32
Message-ID: <32CEB89D.5DC9@cs.com>
References: <1 DOT 5 DOT 4 DOT 16 DOT 19970104111119 DOT 38af165a AT freenet DOT hut DOT fi>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp102.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019