[Qt-interest] How to stop all threads before quit?
Николай Шатохин
n.shatokhin at gmail.com
Wed Mar 2 16:29:31 CET 2011
Ok, I'll try. Thanks.
You can see function mainLoop in thread. I hate it. Maybe it's exist
qt method to do this?
2011/3/2 Mandeep Sandhu <mandeepsandhu.chd at gmail.com>:
>> Scanner working in thread. If user close window, thread still running and
>> program finishing unexpectedly. So, how can I close all threads before
>> exiting program?
>
> You need to quit your thread gracefully by exiting the run() method of
> your thread and delete your thread object only after that.
>
> I gave a quick look to your code and seems like you're quitting the
> run method correctly...but...you need to "wait()" for the thread
> before destroying your thread object. So call QThread::wait() in your
> thread object's d'tor and it should work.
>
> HTH,
> -mandeep
>
>>
>> Best regards,
>> Nick.
>> --
>> За використання революційного клієнта електронної пошти Opera:
>> http://www.opera.com/mail/
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at qt.nokia.com
>> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>>
>
More information about the Qt-interest-old
mailing list