[Qt-interest] QWaitCondition prevents signals from calling slots

Stephen Collyer scollyer at netspinner.co.uk
Wed May 20 16:37:21 CEST 2009


2009/5/20 Thiago Macieira <thiago.macieira at trolltech.com>


>  A timer is basically a way to ask the event loop to send you an
> event after timeout. So you can only use timers from threads that are
> running event loops. This restriction is exactly because of the problem
> you're seeing: if the thread isn't running an event loop, then the timer
> will never be processed.
>

You can only use a QTimer if you have an event loop, but you can
still implement timer logic in a QThread without one, by moving the
timer logic into a separate thread with an event loop, and having
the timer thread wake a QWaitCondition when its local timer goes
off.

-- 
Stephen Collyer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090520/7d109ab2/attachment.html 


More information about the Qt-interest-old mailing list