[Development] QThread::finished() race → fixing QThread

Thiago Macieira thiago.macieira at intel.com
Thu Nov 3 15:56:20 CET 2011


On Thursday, 3 de November de 2011 14:36:09 Olivier Goffart wrote:
> Now that you mention it, this is a regression against Qt 4.7,
> (isRunning and isFinished used to lock)
> hence the patch: http://codereview.qt-project.org/#change,8063
> (that should be applied to Qt 4.8 please)
> 
> 
> That is not related to the order in which  finished() is emit.

Suppose my code does:

void slotConnectedToFinished()
{
    if (thread.isRunning())
        thread.wait();
    thread.start();
}

With this change, we're sure that isRunning will always return false, even if 
the thread is still running but performing cleanups. Will the thread be 
started again?


-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20111103/6b50b9b1/attachment.sig>


More information about the Development mailing list