Date: Thu, 4 Sep 1997 20:36:51 +0300 (IDT) From: Eli Zaretskii To: Oberhumer Markus cc: djgpp-workers AT delorie DOT com Subject: Re: stdin binmode + Ctrl-Break In-Reply-To: <199709030815.LAA24162@is.elta.co.il> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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.