www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1997/09/04/13:40:28

Date: Thu, 4 Sep 1997 20:36:51 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Oberhumer Markus <k3040e4 AT c210 DOT edvz DOT uni-linz DOT ac DOT at>
cc: djgpp-workers AT delorie DOT com
Subject: Re: stdin binmode + Ctrl-Break
In-Reply-To: <199709030815.LAA24162@is.elta.co.il>
Message-ID: <Pine.SUN.3.91.970904203616.27525I-100000@is>
MIME-Version: 1.0

On Wed, 3 Sep 1997, Oberhumer Markus wrote:

> > You forget that signal handling is delayed until your app is back in 
> > protected mode and in its main thread.  Since your program is parked 
> > inside a real-mode DOS call (that reads from stdin), you never get to 
> > handle the signal.
> 
> But I can reenable Ctrl-C with __djgpp_set_ctrl_c (or similiar) - 
> and then I can interrupt the program.

AFAIK, you can't, not in general.  When you re-enable Ctrl-C, the
DJGPP keyboard handler notices the keypress and records it, but the
actual handling is still delayed until the real-mode DOS call returns
to your protected-mode code.  The only case where your program will be
interrupted is when you are reading a single character from stdin:
then Ctrl-C is that single character, and it causes the DOS call to
return.  But if you read more than that, you are stuck.  Ctrl-Break
doesn't terminate the DOS call (since it is not a character and cannot
be ``read''), so you are always stuck.

If you can write a program that can be interrupted while it's parked
in the `read' call, please post it.

- Raw text -


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