[Qt-interest] Qt signaling smarts...
Alan Ezust
alan.ezust at gmail.com
Wed Nov 25 17:45:22 CET 2009
On Tue, Nov 24, 2009 at 9:52 AM, Gordon Schumacher <gordon at rebit.com> wrote:
> BRM wrote:
> > Is the Qt Signal/Slot mechanism smart enough to figure out that the
> thread1 could be sending directly to thread2, and bypass the mainProgram
> signal altogether (since it's all just signals triggering each other)?
> > OR is it at least smart enough that it will not invoke the event loop in
> mainProgram when delivering the signal from thread1 to thread2?
>
> I'm gonna go out on a limb here and say "no", only because it would not
> only need to know that there's a signal "chain" there, but also that
> nothing else has connected to thread1's signal (because otherwise it
> would need to fire it anyway).
>
> (Thiago, please don't throw anything at me here...) If you were gonna
> be *really* clever about it, you could perhaps do something like:
>
> 1. Connect thread1's signal to a "special" slot in mainProgram called
> something clever like forward().
> 2. The forward() function, when called, disconnects sender() from
> forward() and connects it to thread2()'s slot instead.
>
>
Have you ever tried disconnecting a signal while you are in the middle of
executing its slot?
I usually get a crash when I try that.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091125/4f80806e/attachment.html
More information about the Qt-interest-old
mailing list