[Qt-interest] AutoConnection and Threads
elizabeta petreska
elizabeta.petreska at gmail.com
Tue Oct 25 10:33:36 CEST 2011
Hi,
I checked this multiple times, and I am emitting the signal from the same
thread , as the receiver object lives. I am seeing this with the Threads
Windows in Visual Studio . I will check again.
I also tried to go in qt code with t he debugger to figure out what is
happening, but don't understand much. Still I think the relevant part is
this :
if ((c->connectionType == Qt::AutoConnection
&& (currentThreadData != sender->d_func()->threadData
|| receiver->d_func()->threadData !=
sender->d_func()->threadData))
|| (c->connectionType == Qt::QueuedConnection)) {
queued_activate(sender, signal_absolute_index, c, argv ?
argv : empty_argv);
continue;
Also I try to make minimal code example and send here.
On Tue, Oct 25, 2011 at 10:21 AM, Thiago Macieira <thiago at kde.org> wrote:
> On Tuesday, 25 de October de 2011 09.44.35, elizabeta petreska wrote:
> > So I understand that thread affinity of the sender is not important in
> the
> > resolution of an AutoConnection, the important thing in resolution is in
> > which thread the signal is emitted, right ?
>
> Correct.
>
> > So, I have sender object that is created in thread other than the main
> > thread, and a receiver object that is created in main thread, and they
> are
> > connected with AutoConnection. However, the sender emits the event in the
> > main thread, so the type of connection should be resolved to direct, and
> the
> > reciver slot should be invoked directly. However this is not the case,
> i.e
> > the AutoConnection is resolved as queued and the slot is executed next
> time
> > the main event loop gets control. Why is this ? Can someone explain this.
> >
> > I see this behavior in Qt 4.7.4 and also in Qt 4.5
>
> Your diagnosis is probably wrong. I guess you're not emitting the signal
> from
> the thread you think you're doing it.
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Software Architect - Intel Open Source Technology Center
> PGP/GPG: 0x6EF45358; fingerprint:
> E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20111025/1e359541/attachment.html
More information about the Qt-interest-old
mailing list