delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/10/20/08:01:21

Date: Sun, 20 Oct 1996 13:56:28 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: "John M. Aldrich" <fighteer AT cs DOT com>
Cc: grendel AT ananke DOT amu DOT edu DOT pl, djgpp-workers AT delorie DOT com
Subject: Re: Install thingy
In-Reply-To: <32670863.22BE@cs.com>
Message-Id: <Pine.SUN.3.91.961020134751.29874F-100000@is>
Mime-Version: 1.0

On Thu, 17 Oct 1996, John M. Aldrich wrote:

> But an odd thing happened when I was testing:  if I pressed Ctrl-C, the
> program exited instantly; while if I pressed Ctrl-Break, the system
> would wait for another keystroke before exiting.  Is this an artifact of
> using the conio functions (cgets, getch) instead of stdio?  As I recall,
> when SIGINT is not handled, both keystrokes cause immediate
> termination.  FYI, it happened under both Windoze and CWSDPMI.

Recall that the signals aren't handled until your program is back in
protected mode.  When your program waits for a keystroke, it will get
Ctrl-C immediately (that's a keystroke, right?), switch to PM and get an
exception.  Ctrl-Break, OTOH, is not a keystroke (you can never get it by
calling `getch'), so your program continues to be parked inside a
real-mode BIOS call issued by `getch' until it gets a *real* keystroke;
then it switches to PM--and the rest is history. 

> BTW, is the fact that a generated SIGINT terminates ALL programs in an
> execution chain simultaneously unless one of them handles it a feature
> or a bug?  Just curious...

It's a feature.  Unix works in this way (i.e., the parent gets the 
signals of its children unless it takes specific action not to), so DJGPP 
does that also, since it's relatively easy.  The latest port of GNU Make 
3.75 uses this to correctly say "Interrupt" when the compilation is 
interrupted, just like on Unix.

Note that, unlike Unix, only SIGINT works this way; other signals (such 
as SIGFPE) don't.

- Raw text -


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