[Qt-interest] QThread Question

Donal O'Connor donaloconnor at gmail.com
Thu Aug 6 12:43:01 CEST 2009


Hi,

I've got code here written by somebody else that seems to make use of
several threads but I'm quite worried that the processing is not done in a
different thread like intended.

They've created an object derieved from QThread but never implemented the
run method so it defaults to the exec() event state when started.
Now, they've created slots and these slots by the looks of it does the hard
work which to the best of my knowledge results them being run in the calling
thread.

Am I correct in saying, that if you call a method of a QThread object or
arrive at a slot due to a Queued connection that the processing done in the
slot/method
is done in the calling thread and not in the actual thread that was stared
for the QThread object?

To the best of my knowledge, the way it should be done, is all the
processing done in the run() method but use the methods/slots to change
data/state of thread of the thread but using Mutex's since it's the calling
thread that will be modifying the data and should be mutually exclusive from
the run method which reads or writes to this data.


Am I correct in what I'm saying here? - Apologies if it's obvious but this
code I'm looking at is starting to confuse me.


Thanks very much,
Donal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090806/e7878f7b/attachment.html 


More information about the Qt-interest-old mailing list