[Interest] Signal Slot Ordering (or Not)

Jay wz12 at yeah.net
Thu May 19 10:01:35 CEST 2016


I think that Signal and Slot mechanism depends on the Event Loop, there must be a event loop.
why not show your source code?

At 2016-05-19 03:07:15, "Peter M. Groen" <peter at osdev.nl> wrote:
>In a simple setup ( One sender object with a signal, One receiver with
>a slot, argument is sequence number, both objects running in a
>single thread ) some unexpected behaviour (at least for me) is noticed.
>
>The connect between the mentioned signal / slot is done with
>Qt::DirectConnection. According to the documentation, each slot is
>called directly. ( The slot is invoked immediately when the signal is
>emitted. The slot is executed in the signalling thread. )
>
>In a for-loop, I'm sending 10 signals directly in one burst, like so :
>
>    for( int nCount = 0; nCount < number_of_signals; nCount++ )
>    {
>        std::cout << "[SignalSender::timerTimeOut] - "
>                  << QString( "Signal Sending. Timer : %1, Run : %2,
>    Sequence : %3" ) .arg( timer_interval_msecs )
>                     .arg( run_number )
>                     .arg( nCount ).toStdString() << std::endl;
>        emit signalSendSequence( timer_interval_msecs, run_number,
>    nCount ); QCoreApplication::processEvents();
>    }
>
>I'm expecting the output would be in ascending order, but every once in
>a while, the output is all thrown together. That is quite unexpected,
>based on the documentation.
>
>Is this a bug, or by design?
>
>Regards,
>
>-- 
>Open Systems Development
>Peter M. Groen
>Het Buitenwater 54
>2235 TB  Valkenburg (ZH)
>Mob : +31 6 811 0 3537
>Email : peter at osdev.nl
>Skype : peter_m_groen
>_______________________________________________
>Interest mailing list
>Interest at qt-project.org
>http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160519/28a7d865/attachment.html>


More information about the Interest mailing list