[Qt-interest] adressing something to the mainWindow from adialog

Andrea Franceschini therealmorpheu5 at gmail.com
Wed Apr 8 19:45:40 CEST 2009


Thanks for your thorough explanation, John. I've never really thought
of using signals and slots this way. I am now a bit concerned about
performance, anyway. Even if the docs imply that on fairly recent
hardware you can emit like a gazillion signals per seconds, given one
receiver connected, as it shall be obvious, it doesn't really seem to
scale very well, as in slightly-more-than-half a gazillion signals per
seconds when another receiver is connected. This, of course, assuming
-- well, I am assuming it -- the receivers are doing plenty of nothing
in their slots.

Now, what if I had two objects that needed to continuously monitor the
same value -- namely a value which is a property of one of the two and
that each of the two objects are entitled to both read and write? This
would be the academic case of two communicating endpoints over the
same channel which is a member of one of the two objects. Such can be
solved, when appropriate, with mutexes (here for "appropriate" I'm
implying that the communication channel is strictly under control of
the system such as a shared memory buffer on the same machine that
runs the two endpoints).

But even if we had this mutex control and we still had to read and
write the buffer via signals, and assuming that many other objects --
not as many as a gazillion, but the speculation still holds -- may
want to connect to the buffer, how's performance going to be affected?

Wait, I realise that I'm making up a very special case and I
appreciate the beauty of the formal approach you've suggested, but
recently I found myself thinking about the dangers of a similar case:
in such a case, wouldn't it be better to go for the parent linking its
children to its internal variable protecting it via mutual exclusion?
Or the overhead given by the mutex would still affect performance like
the other case?

-- 
Andrea



More information about the Qt-interest-old mailing list