ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/08/18/07:03:14

From: Xavier Leroy <Xavier DOT Leroy AT inria DOT fr>
Subject: Polling for ctrl-C
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Date: Tue, 18 Aug 92 12:30:41 MET DST
Reply-To: Xavier DOT Leroy AT inria DOT fr

I have ported an interactive program from Unix to the PC, using DJGPP.
The program needs to trap keyboard interrupts. The Unix version just
sets up a signal handler for SIGINT. As far as I know, this is not
implemented by the DJGPP library. I can understand that it's pretty
hard to generate an asynchronous interrupt from the DOS side, and have
it execute some 386 protected-mode code.

But the fact is I do not need asynchronous interrupts: for various
reasons, the program I'm porting cannot be interrupted at any time, so
the signal handler just sets a global flag, and the main program
periodically polls this flag.

It seems to me that it would not be very hard to implement this
behavior in GO32: the ctrl-C and ctrl-break handlers would set a flag,
and the program running in protected mode could would poll this flag,
either directly, or through a software interrupt.

My question is: has anybody experienced with a similar scheme? Any
hint on how to implement this ctrl-C handling in GO32 is most welcome.

Thanks for your help,

- Xavier Leroy

- Raw text -


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