[Qt-interest] Interesting QThread problem
BRM
bm_witness at yahoo.com
Wed Nov 24 15:24:00 CET 2010
There is also the quit() slot, which will terminate the thread's event loop
gracefully if you use it. It won't guarantee everything will be processed by the
thread, but it will exit gracefully unlike terminate().
Ben
----- Original Message ----
> From: Scott Aron Bloom <Scott.Bloom at onshorecs.com>
> To: qt-interest at trolltech.com
> Sent: Tue, November 23, 2010 6:01:24 PM
> Subject: Re: [Qt-interest] Interesting QThread problem
>
> Yes,
>
> Set some type flag, and set it, then your working loop in your thread
> could check for the flag and quit properly when detected.
>
> I suggest you read a book on threading, its difficulties, and how to
> solve them..
>
> It sounds like you understand the Qt side but not the underlying science
>
> Scott
>
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com
> [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Yifei Li
> Sent: Tuesday, November 23, 2010 2:46 PM
> To: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] Interesting QThread problem
>
> 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
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
> _______________________________________________
> 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