[Development] QThread usage/guidance

Tony Van Eerd tvaneerd at rim.com
Fri Oct 5 16:31:51 CEST 2012


What was the final resolution (if any) of  the email thread "QThread::finished() race → fixing QThread"
http://lists.qt-project.org/pipermail/development/2011-November/000284.html


In particular as seen in http://mayaposch.wordpress.com/2011/11/01/how-to-really-truly-use-qthreads-the-full-explanation/

                worker->moveToThread(thread);
                connect(worker, SIGNAL(error(QString)), this, SLOT(errorString(QString)));
                connect(thread, SIGNAL(started()), worker, SLOT(process()));
                connect(worker, SIGNAL(finished()), thread, SLOT(quit()));
                connect(worker, SIGNAL(finished()), worker, SLOT(deleteLater()));
                connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));

Is there a race where the worker deleteLater() doesn't happen due to the thread having already finished?

I'm trying to provide guidance to teams on QThread usage...

---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20121005/86f9e07d/attachment.html>


More information about the Development mailing list