[Qt-interest] Controlling when timers run
André Somers
andre at familiesomers.nl
Thu Jan 14 19:16:31 CET 2010
Hi,
Are you sure you actually have a real issue here?
Qt's timers are driven through the event loop. The (main) event loop only
runs when the main thread is not bussy doing something else, like being
engaged in some loop or stack of other calls that are executed (provided
those don't call the processEvents() method, of course). That means that, as
long as a single function call leaves all your data in a consistent state,
you don't need to be worried about a QTimer call interrupting you. This kind
of thing is only an issue if you start using processEvents or threads.
André
-----Oorspronkelijk bericht-----
Van: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] Namens Glenn Hughes
Verzonden: donderdag 14 januari 2010 3:17
Aan: qt-interest at trolltech.com
Onderwerp: [Qt-interest] Controlling when timers run
Hello,
I was wondering if anyone could give me some advice about the following:
I often want to run various tasks periodically, but only when the
stack is "fully unwound" i.e. from the first call to exec, not when
any subsequent exec loops (or other loops) are running, and not when
other calls have been made into the OS that allow timers to run (for
whatever reason).
The motivation is that often timer chores want the program data
structures to be in a known consistent state, but if the timer gets
called in the middle of an operation, things may not be as the chore
code expects, which can easily lead to crashes.
And other tasks I want to run as much as possible (ignoring all the above).
Is there any sort of provision for conditionally running timer chores
like this in Qt?
Thanks in advance
Glenn
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list