Home » Community » Newbie corner » running program at different speeds
Re: running program at different speeds [message #37008 is a reply to message #37007] |
Wed, 08 August 2012 09:54   |
|
varu wrote on Wed, 08 August 2012 08:53 | Dear Sir,
Is there any way to run my loop in my program at different time period in core console app..for example i want to run my program every 10ms only instead of the speed at which is running now..
thanks
varun
|
Hi Varun,
I'm not sure if I understand correctly, but to slow down any loop, you can just insert call to Sleep(int ms) in it. E.g.:while(work_not_done){
//do something
Sleep(10); // wait ~10 ms before continuing
}
Sleep is defined in Core package, so it can be used in any application. If you are using Threads, there is also similar function Thread::Sleep().
Best regards,
Honza
|
|
|
Goto Forum:
Current Time: Sun Jun 08 13:49:41 CEST 2025
Total time taken to generate the page: 0.03808 seconds
|