Mail Archives: djgpp/1998/12/18/10:46:01
If you want to release the time slice, write your own sleep function.
Maybe something like this:
void sleep(int msec)
{
clock(); //Can't remember which fxn to use
do
_dpmi_yield();
while(!(clock()>=msec));
}
I'm not sure that I wrote this right, but it should work.
dj-admin AT delorie DOT com wrote:
On Thu, 17 Dec 1998 10:56:03 -0500, in comp.os.msdos.djgpp you 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???
Perhaps because DJGPP is DOS and DOS is not multitasking sleep just
wastes time rather than giving the time back to the OS to be used by
other processes.
>I was expecting the program to sleep quietly for 5 secs and then
>continue
>the while();
>
>The same code is working fine on the UNIX machine.
>if this is NT being silly then how can I get around this?
No this is not NT being silly because sleep works as expected when
compiled with VC and Borland 5.0
____________________________________________________________________
Get free e-mail and a permanent address at http://www.netaddress.com/?N=1
- Raw text -