[Qt-interest] Qt signaling smarts...
Gordon Schumacher
gordon at rebit.com
Tue Nov 24 22:30:26 CET 2009
Thiago Macieira wrote:
> Remember that an auto connection is queued if the *target* object is in a
> different thread. If objects B and C are in the main thread, and you have the
> connection A→B→C and you emit A's signal in the auxiliary thread, it would
> originally cause the first connection to be queued and the second one would be
> DirectConnection. If you force the first one to be direct, B's signal is
> emitted in the auxiliary thread. Buy then the second connection becomes queued
> because C is in a different thread.
>
Ah - I think I over-complexified my idea of what was going on; I was
imagining that B was the QApp thread, and A and C were each in their own
threads.
> There is still a small race condition if you connect or disconnect in one
> thread while the other emits. No crash will happen, but you may be surprised
> that the connection gets emitted (or not) when you weren't expecting.
>
...and as long as you're doing things "right", that shouldn't be an
actual problem.
More information about the Qt-interest-old
mailing list