[Qt-interest] Confused by dev-net wiki article: inter-thread sig-slot connections

Giuseppe D'Angelo dangelog at gmail.com
Fri Jun 17 15:14:46 CEST 2011


> I remember (I think Thiago had mentioned it), that Qt will compare the
> thread affinity of the object that emitted the signal with that of the
> object that has the receiving slot. If they're same, a direct
> connection would be made.

I've pointed out several times in that document as well: the _current_
thread (not the one of the sender object) is compared with the
receiver's thread:

Quoting that page:

> In every case, keep in mind the thread the emitting object is living in has no importance at all! In case of an automatic connection, Qt looks at the thread that invoked the signal and compares it with the thread the receiver is living in to determine which connection type it has to use.

Also, it has been fixed in the Qt docs:

http://doc.qt.nokia.com/4.7/threads-qobject.html

> # Auto Connection (default) If the signal is emitted in the thread which the receiving object has affinity then the behavior is the same as the Direct Connection. Otherwise, the behavior is the same as the Queued Connection."

-- 
Giuseppe D'Angelo



More information about the Qt-interest-old mailing list