mercredi 18 mars 2015

Is it ok to unlock a mutex twice in Qt 5.4?


The code is as following:



waitmutex.lock(); //waitmutex is a QMutex
int tout=4000;
if(!waitc.wait(&waitmutex,tout))
{
waitmutex.unlock(); // unlock first time
mutex.lock();
if(tileCacheQueue.count()==0)
{
mutex.unlock();
break;
}
mutex.unlock();
}
waitmutex.unlock();// unlock the second time possibly?


Will the code possibly results in the waitmutex to be unlocked twice? Is this a problem in Qt?




Aucun commentaire:

Enregistrer un commentaire