OT: Re: Trick to low CPU usage?
"Mike Smith" <mike_UNDERSCOR E_smith@acm.DOT .org> wrote in message
news:vr50pue06k rp9c@news.super news.com...[color=blue]
> Jakob Bieling wrote:[color=green]
> >
> > <Platform-Specific> On Windows you can use "Sleep" to have your[/color][/color]
process[color=blue][color=green]
> > sleep for n milliseconds. For other platforms I do not know.
> > </Platform-Specific>[/color]
>
> <more-platform-specific> Sleep() does not guarantee an exact time. If
> no other threads are ready to run, the Sleep()ing thread could
> conceivably resume immediately[/color]
It's right that it is not exact, but when you say 80ms, your thread is
going to sleep for at least 80ms - guaranteed. This is why I suggested
roughly 80-90ms for the timeout; the remaining 10-20ms are for executing
code and for the inaccuracies.
regards
--
jb
(replace y with x if you want to reply by e-mail)
"Mike Smith" <mike_UNDERSCOR E_smith@acm.DOT .org> wrote in message
news:vr50pue06k rp9c@news.super news.com...[color=blue]
> Jakob Bieling wrote:[color=green]
> >
> > <Platform-Specific> On Windows you can use "Sleep" to have your[/color][/color]
process[color=blue][color=green]
> > sleep for n milliseconds. For other platforms I do not know.
> > </Platform-Specific>[/color]
>
> <more-platform-specific> Sleep() does not guarantee an exact time. If
> no other threads are ready to run, the Sleep()ing thread could
> conceivably resume immediately[/color]
It's right that it is not exact, but when you say 80ms, your thread is
going to sleep for at least 80ms - guaranteed. This is why I suggested
roughly 80-90ms for the timeout; the remaining 10-20ms are for executing
code and for the inaccuracies.
regards
--
jb
(replace y with x if you want to reply by e-mail)
Comment