[Qt-interest] Send signal from one thread to another (all threads sends in one loop)
Николай Шатохин
n.shatokhin at gmail.com
Thu Jun 23 16:52:10 CEST 2011
But if threads very many, it can be slow.
2011/6/23 Andrea Franceschini <therealmorpheu5 at gmail.com>:
> 2011/6/23 Николай Шатохин <n.shatokhin at gmail.com>:
>
>> How to send signal from one thread to slot in
>> another directly? I will glad if somebody shows me example of source.
>
> Hi Nick, I've been off Qt development for a while so my answer may be
> missing something that happened in the latest two years :) but I think
> your question contains the answer. In fact you could move the check on
> the ids in the server and only send the signals to those that match.
> This way you'd probably end up sending fewer signals and only to the
> relevan threads.
>
> Another solution may be to make the server connect signals and slots
> of the threads when they're created, but this may very well be
> technically impossible (as I said, I've been away for two years and I
> barely remember the basics of Qt despite having been an avid user :)
>
> Anyway I think the best approach here (conceptually speaking) is to go
> through a centralized router, which is what you're doing now, except
> if you have to exchange a lot of messages that may slow down the whole
> thing. I say this because I myself had to do this exact thing and
> performance weren't great at all--at least until I managed to greatly
> reduce the number of signals emitted.
>
>> P.S. Sorry for my English. I'm studying now.
>
> Never be sorry for this as long as you are understood :)
>
> --
> Andrea
>
More information about the Qt-interest-old
mailing list