www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/28/10:30:25

From: Thomas Demmer <demmer AT LSTM DOT Ruhr-UNI-Bochum DOT De>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: ctrl-c handling question
Date: Wed, 28 Jan 1998 16:28:15 +0100
Organization: Lehrstuhl fuer Stroemungsmechanik
Lines: 44
Message-ID: <34CF4E8F.95E933D6@LSTM.Ruhr-UNI-Bochum.De>
References: <01bd2bf2$0f2058a0$542c5c8b AT aptiva>
NNTP-Posting-Host: bvb.lstm.ruhr-uni-bochum.de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Jerry van Dijk wrote:
> When running the following program:
>         int main(void){
>                 int i;
>                 i = 5;
>                 while (i == 5) {;}
> 
>                 return 0;
>         }
> pressing CTRL-C will abort it.
> However, when running the following program:
> 
>         int main(void)
>         {
>                 while (1) {
>                 }
>         } 
> pressing CTRL-C has no effect.
> Anyone have any idea as to the cause and how to get around it ?
> 
That's a flaw? of the DPMI host. It can only intercept
^C when your program touches memory. In the first case it does, 
unless you use -O2 or so to compile it. In the second case,
there is no need do access memory, everything is inside
registers. So, the DPMI host never sees the ^C.

I think there is no way to come around this.

I had to trim your program a bit, otherwise my news host
would not le me post it.
-- 
Ciao
Tom

*************************************************************
* Thomas Demmer                                             *
* Lehrstuhl fuer Stroemungsmechanik                         *
* Ruhr-Uni-Bochum                                           *
* Universitaetsstr. 150                                     *
* D-44780  Bochum                                           *
* Tel: +49 234 700 6434                                     *
* Fax: +49 234 709 4162                                     *
* http://www.lstm.ruhr-uni-bochum.de/~demmer                *
*************************************************************

- Raw text -


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