Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1791
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

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
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Add layout
Next Topic: Trouble with Socket
Goto Forum:
  


Current Time: Sun Jun 08 13:49:41 CEST 2025

Total time taken to generate the page: 0.03808 seconds