[Qt-interest] Interesting QThread problem

Yifei Li yifli at mtu.edu
Tue Nov 23 23:46:06 CET 2010


Thanks. Is there an alternative to terminate() ?

Yifei
On Nov 23, 2010, at 5:39 PM, Thiago Macieira wrote:

> On Tuesday, 23 de November de 2010 23:18:57 Yifei Li wrote:
>> The following code is a minimal example of what I'm trying to do.  Once the
>> plugin prints out one message, it will wait until 'Next' button is clicked
>> to print out the next message. Try to terminate the execution by clicking
>> 'Stop' and then start the execution.  You will notice the first message is
>> printed out fine. But when you click on 'Next' button to print the second
>> message, the whole app seems to deadlock.
> 
> That's to be expected. Calling QThread::terminate() is a forceful termination 
> and will probably leave behind locked mutexes and other resources.
> 
> Solution: don't use terminate.
> -- 
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
>  Senior Product Manager - Nokia, Qt Development Frameworks
>      PGP/GPG: 0x6EF45358; fingerprint:
>      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest





More information about the Qt-interest-old mailing list