|
|
Larry Martell schrieb:
--- Till Oliver Knoll <oliver.knoll@xxxxxxxxxxx>
wrote:
Larry Martell schrieb:
I am trying to set up a multi threaded app. I am
following the example from chapter 17 of the
Blanchette/Summerfield book. I subclassed QThread
...
This code is just for illustration purposes, your
actual code might be
structured differently, but let's assume you have
something like this:
void foo() {
Thread QCMthread; // the Thread instance
[...]
QCM::Halt(); // operates on 'QCMthread' instance
// now the automatic QCMtrhead instance is
destroyed, even though
// it is still running here (at least it _might_
still
// be running)
..
That would be true if QCMthread was a local variable,
but in my case it's public variable from the QCM
class, so it shouldn't be going out of scope.
As I said, I don't know your actual code setup, so I can only guess
what's going on.
Anyway, what about the QCM class then? Is this one destroyed
(automatically or manually with 'delete') after you issue a call to
Halt()? Because if so, you would still have the same situation as
described above:
{
// some scope
QCM qcm;
...
qcm.Halt();
// same problem here
}
Did you try putting the QThread::wait() into your Halt() method as I
suggested? Did it make any difference?
Good luck, Oliver
|
|