Date: Tue, 14 Mar 2000 09:48:55 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Rafael García cc: djgpp AT delorie DOT com Subject: RE: pause() in idle programas In-Reply-To: <8aipsn$a5e$1@diana.bcn.ttd.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Content-Transfer-Encoding: 8bit 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 Precedence: bulk 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.