Mail Archives: djgpp-workers/1997/09/04/13:40:28
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 -