Archived

This topic is now archived and is closed to further replies.

pws

interupt time ticks.

Recommended Posts

pws    122
I am implementing a simulation of shadowing within water. I''m looking for a function that creates ticks at each 1/10 seconds precisly and a handler function that is called in each tick. This function should be interupted even if there is another event that is being handled at the same time. I tried to use "glutTimerFunc" but it was not good. does any one know how to solve my problem. (or maybe there is a different function in c++ or WindowsOS). Thanks.

Share this post


Link to post
Share on other sites
Lantz    142
I think getting it to interrupt in the middle of something on windows would be quite hard, and even if it could be done it would bring quite a few synchronization issues. Are you sure you want to deal with that?

The easiest way would be to set up a windows timer using SetTimer. This would make windows send you a WM_TIMER message every now and then. However this would of course only be processed in your message checking code.

If you really want it to occur at any time you could try creating a separate thread. It could then do a Sleep( 10 ) or loop on QueryPerformanceCounter or something similiar, do its task and then start over. However be very careful with this as synchronization isnt the easiest thing.

Share this post


Link to post
Share on other sites