Date: Sun, 20 Dec 1998 11:27:44 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Agent Drek cc: djgpp AT delorie DOT com Subject: Re: cpu eater In-Reply-To: <36792993.F93B6D04@monsterbymistake.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com On Thu, 17 Dec 1998, Agent Drek wrote: > I am wondering why it appears that the sleep function with > the code compiled under DJGPP on the NT seems to use 100% of my CPU??? Are you sure you are measuring the CPU load with a right tool? I compiled a program very similar to yours, and it uses a negligible amount of CPU time while sleeping. This is because the library function `sleep' issues the __dpmi_yield call while it waits, which should release the program's time slice to the OS. I used the NT-standard Task Manager utility (Press Ctrl-Alt-Del, then click "Task manager" and choose Processes) to test this. > while(1) > { > /* Poll render queue file */ > _curr = brqe(); > printf("%u\n",_curr); > sleep (5); > } Could it be that the call to `brqe' is the one where all the CPU is eaten up? (Obviously, I couldn't test that, but I replaced it with a call to `kbhit'.)