[Solved] Timer routines that overrun the timer period



  • I'm working on an ARM9 linux device. I have a timer that goes off every 300ms to update the display. I connect the timeout() signal of the timer with a slot function called updateTimer(). Depending on the inputs, I may have to do some file processing and handling which I'm sure is going to take more than 300ms. Can I leave it right in the updateTimer() function, or should I set up another signal/slot connection in the same object to do the file stuff?



  • I would suggest that when the timer fires, you create a processing job and have it executed asynchronously, for example by a runnable. This way you will be able to receive all the timer calls, at least.



  • What do you mean by a "processing job?"



  • Whatever you are trying to do when the timer fires. You said:

    [quote author="Endless" date="1328541506"]Depending on the inputs, I may have to do some file processing and handling which I'm sure is going to take more than 300ms.[/quote]

    Just take whatever you do there, wrap it in a runnable, and stick it in the QThreadPool. QThreadPool has examples on how to do that. You don't want to do anything that can take 300ms or longer in the main thread, in general.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.