www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/08/22/04:33:51

Date: Thu, 22 Aug 2002 10:56:27 +0300
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: "Alex Oleynikov" <alex AT compuweigh DOT com>
Message-Id: <7263-Thu22Aug2002105626+0300-eliz@is.elta.co.il>
X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 1.8.9
CC: djgpp AT delorie DOT com
In-reply-to: <frN89.72711$Pb.3104967@news2.east.cox.net> (alex@compuweigh.com)
Subject: Re: Problem with tight kbhit() loop
References: <frN89.72711$Pb DOT 3104967 AT news2 DOT east DOT cox DOT net>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: "Alex Oleynikov" <alex AT compuweigh DOT com>
> Newsgroups: comp.os.msdos.djgpp
> 
> I have a question about using kbhit() function in a tight loop like the one
> below:
> ...
> while( !kbhit() );
> 
> ch = getch();
> ...
> 
> If I just run the program that contains this code everything works fine.
> Now, if I run this program under the RHIDE's debugger and have some
> breakpoints prior to the code listed above, then this loop never quits and
> computer locks up completely (only cold re-boot helps to restart it) and
> sometimes even my CMOS settings are get screwed up, so BIOS loads their
> default values at start-up making me go nuts restoring them :o).

Is this on plain DOS or on Windows?

If the former, I think it's a known side-effect of the way CWDPMI
implements the DPMI Interrupt 31 handler: after certain operations
interrupts are left in disabled state.  Try inserting __asm__("sti")
inside the loop, and I think the problem will go away.

- Raw text -


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