PDA

View Full Version : QtService stop Subthreads



Willi
23rd January 2014, 22:05
Hi,

I have an application using QtService and a Worker-Class with a couple of Subthreads. Now I have a Problem that I'm not sure how to wait in the Service-Stop funtion that all Subthreads are ended. I tried it in the way:

QEventLoop loop;
loop.connect(&thread, SIGNAL(finished()), SLOT(quit()));
loop.exec();

where "thread" is the thread Controlling the main-Workerclass. It is stopped when the last Subthtread is finished. This works okay. But in the Servcie the end of the QEventLoop is never reached. Is my way completly wrong?

Thanks and regards,
Willi

ChrisW67
23rd January 2014, 23:07
Have you told the thread to stop or are you just assuming that it will?

Willi
24th January 2014, 10:31
Yes, I told all threads to Exit. But I found the Problem. One of the threads did not Exit properly. So the way to wait in the stop()-function of the QtService is fine.

Thx!