[Qt-interest] Forcing a signal "emit" to be queued

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Tue Mar 22 08:34:58 CET 2011


>>
>> I think it used to do that but got fixed at some point. Not really sure.
>> But then, why do you care much ?

I do because timer creation deletion is not a trivial op, I think.
Though this point is moot if it isn't involved for 0 sec intervals :)

>
> Just checked the code and QTimer::singleShot() uses QMetaObject::invokeMethod()
> with a Qt::QueuedConnection if msec is 0

Ummm...where is this interval check? I'm using Qt 4.6.2 on a unix
platform and the trace goes like this:

QTimer::singleShot() > QObject::startTimer() >
QAbstractEventDispatcher::registerTimer() >
QEventDispatcherUNIX::registerTimer() >
QEventDispatcherUNIX::registerTimer() >
QTimerInfoList::registerTimer() > ...after this I'm kinda lost! :)

The case you point out, is happening for the win32 platform I think
(in my 4.6.2 src).

<snip>
if (!t->interval)  // optimization for single-shot-zero-timer
            QCoreApplication::postEvent(q, new QZeroTimerEvent(t->timerId));
</snip>

CMIIW.

Thanks,
-mandeep

>
> --
> GPG-Key: 0xA3FD0DF7 - 9F73 032E EAC9 F7AD 951F  280E CB66 8E29 A3FD 0DF7
> Debian User and Developer.
> Homepage: www.foolab.org
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>



More information about the Qt-interest-old mailing list