www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/14/07:43:07

Date: Tue, 14 Mar 2000 09:48:55 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Rafael García <rafael AT geninfor DOT com>
cc: djgpp AT delorie DOT com
Subject: RE: pause() in idle programas
In-Reply-To: <8aipsn$a5e$1@diana.bcn.ttd.net>
Message-ID: <Pine.SUN.3.91.1000314094829.4527F-100000@is>
MIME-Version: 1.0
X-MIME-Autoconverted: from QUOTED-PRINTABLE to 8bit by delorie.com id CAA07589
Reply-To: djgpp AT delorie DOT com
Errors-To: dj-admin AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Mon, 13 Mar 2000, Rafael García wrote:

> > >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.
> >
> > Don't use pause(), use __dpmi_yield() instead.
> 
> I don't see the difference. Performance is the same, it works much better
> without both.

The function `pause' already calls `__dpmi_yield' internally, so it's
a small wonder that you don't see any difference.

I think the problem is that your `maintenance' function does something
CPU-intensive, and that is the cause for what you see.  It's only a
guess, but since you didn't tell what does `maintenance' do, what else
can I do?

FWIW, I routinely run Emacs compiled with DJGPP, which does tons of
complicated stuff inside its idle loop, and I don't see any visible
effect on other DOS boxes.  In particular, the CPU usage shows
something like 5% when Emacs is idle.  So I'm curious what could your
program do to use the CPU so heavily.

- Raw text -


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