[Qt-interest] Proper way to terminate QThreads
Thiago Macieira
thiago at kde.org
Tue Nov 17 22:32:09 CET 2009
Em Terça-feira 17. Novembro 2009, às 22.16.33, Cyril C. escreveu:
> Thiago Macieira a écrit :
> > Hi Ben
> >
> > Calling quit() from any thread is thread-safe. That will cause the event
> > loop to exit at the earliest opportunity. The control will return to the
> > run() function, which should just return at that point.
>
> I have an additional question on that topic : when you say "at the
> earliest opportunity", does it mean that any pending events in the
> thread's event loop will be discarded ?
Yes, that's correct.
The current event queue being processed gets finished before the event loop
returns. And quit() doesn't cause instantaneous exit either: any functions
running need to return control to the event loop in the first place.
--
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091117/cec74c07/attachment.bin
More information about the Qt-interest-old
mailing list