Mail Archives: djgpp/2000/03/13/05:42:52
From: | "Rafael García" <rafael AT geninfor DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | pause() in idle programas
|
Date: | Mon, 13 Mar 2000 10:26:10 +0100
|
Organization: | Telefonica Transmision de Datos
|
Lines: | 40
|
Message-ID: | <8aibv9$p6j$1@diana.bcn.ttd.net>
|
NNTP-Posting-Host: | 194.179.101.62
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Newsreader: | Microsoft Outlook Express 5.00.2014.211
|
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2014.211
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Hello all, I have an interesting question (I think) about multitasking djgpp
programs under Windows
I have an interactive program that show a menu and wait for the user to take
an action. When it is acomplished, it goes newly to the loop for the
keyboard and so on.
I need to maintain de control while in the pause because I need to do some
light work, for example, to show the time, search for new files in some
directory... so I cannot stop with a getch() to read the keyboard.
My loop is something like this:
int getoption() {
while (!kbhit()) // wait until user touch keyboard
maintenance();
return getch();
}
well, this works, but I think it is a waste of time to the operating system
while I am working with other programs. I thougth of this:
int getoption() {
while (!kbhit()) {
pause(); // or delay(50)
maintenance();
}
return getch();
}
this must do a better work in distributing CPU power between multiple
programs, but I have found that this makes other proccess to perform much
poorly.
How is it possible?
- Raw text -