delorie.com/archives/browse.cgi | search |
From: | "Alex Oleynikov" <alex AT compuweigh DOT com> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Problem with tight kbhit() loop |
Lines: | 28 |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 6.00.2600.0000 |
X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2600.0000 |
Message-ID: | <frN89.72711$Pb.3104967@news2.east.cox.net> |
Date: | Wed, 21 Aug 2002 14:27:23 GMT |
NNTP-Posting-Host: | 68.15.54.9 |
X-Complaints-To: | abuse AT cox DOT net |
X-Trace: | news2.east.cox.net 1029940043 68.15.54.9 (Wed, 21 Aug 2002 10:27:23 EDT) |
NNTP-Posting-Date: | Wed, 21 Aug 2002 10:27:23 EDT |
Organization: | Cox Communications |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Hi all, 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). The problem goes away if I put some time-consuming operation inside the loop, like a call to printf(..) or delay(..) functions. Is there a rational explanation to this situation? Is it specific to DJGPP? I have tried the same code under Borland Turbo C++ 2.0 and it always works fine even if I have the breakpoints to visit before getting into that loop. Thanks in advance, Alex
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |