Mike Parker aldacron71 at
Thu Nov 16 02:34:52 PST 2006

nobody_ wrote:
> How do I make a thread run at a certain rate (x times a second ) without 
> bothering the rest of the program?
> The main-loop runs at about 1000hz and I need to output some of the data to 
> my screen at about 50/60Hz.
> I don't care whether there are frames lost, as long as the main loop runs 
> correctly.
> Or shouldn't I use a seperate thread for the screenoutput?
> Thx 

I don't know what sort of application you want this for, but in 
principle it sounds very much like a typical game loop. Using a separate 
thread for constant update isn't likely not a good strategy. This 
article describes how to separate logic UPS (updates per second) from 
rendering FPS (frames per second):

Following that technique, you should be able to keep your 1000hz loop 
and have your 60hz display updates all in one thread.

More information about the Digitalmars-d-learn mailing list