[Qt-interest] Signal delivery order?

Atlant Schmidt aschmidt at dekaresearch.com
Wed Jul 14 17:53:03 CEST 2010


Frank:

> Your expectation (multiple signals from one thread, targeting
> a single thread) is correct, no matter if you address one or
> multiple slots.

  Thanks for confirming that part of my speculations!

  Anyone else on the earlier part(s)?

                       Atlant

-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Frank Hemer
Sent: Wednesday, July 14, 2010 11:47 AM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Signal delivery order?

On Wednesday 14 July 2010 17:20:06 Atlant Schmidt wrote:
> Folks:
>
>   I'm trying to understand the order in which signals are delivered to
> slots.
>
>   When I look at:
>
>     http://doc.trolltech.com/4.6.2/signalsandslots.html
>
>   It first says:
>
>     If several slots are connected to one signal, the slots will be
> executed one after the other, in the order they have been connected, when
> the signal is emitted.
>
>   But later, it seems to take back that promise by saying:
>
>     If on the other hand you want to call two different error functions
> when the number overflows, simply connect the signal to two different
> slots. Qt will call both (in arbitrary order).
>
>
>   Depending on the implementation details, I could believe that, within a
> single thread, either statement is true (that slots are handed the signal
> in the order in which they were originally connected or that slots are
> handed the signals in an arbitrary order); clearly, the second statement
> subsumes the first and it's easier for the trolls if it's the latter. It's
> also safer for me if *I BELIEVE* it's the latter, even if it's sometimes
> the former, but shouldn't the documentation be self-consistent? Does anyone
> know which statement ("connection order" vs. "arbitrary order") is more
> true? And can you correct the documentation? ;-)
>
>   Meanwhile, I also wonder about the delivery order when multiple signals
> are emitted. Can we take it on faith that if a single thread emits the
> signals A, B, and C in that order, they will be delivered to a single slot
> in a single thread in the same order? How about if they are delivered to
> different (multiple) slots in the same thread? Still A, B, then C, no
> matter which slot they're targetting?
>
>   Note: I understand that most of the ordering promises won't hold any time
>   signals are delivered to different threads; one doesn't know when the
> individual threads will actually be "runnable" so that they can receive the
> signals at their slots. But I would still expect that multiple signals
> emitted from one thread and targeting a single thread will be delivered to
> that thread in the order in which they were originally emitted.

Your expectation (multiple signals from one thread, targeting a single thread) is correct, no matter if you address one or multiple slots.

Frank


This e-mail and the information, including any attachments, it contains are intended to be a confidential communication only to the person or entity to whom it is addressed and may contain information that is privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.




More information about the Qt-interest-old mailing list