QThread & QMutex
Unsolved
General and Desktop
-
@SGaist said in QThread & QMutex:
Out of curiosity, what is your use case ?
Hi;
tryLock always returns true.
// RSM is own object (Remote Service Manager. It likes OO-RPC (and likes Qt Remote Object). CChRSM { id : chRSM } CChRSMNetworkAccessManager { id : chTestx chRSM : chRSM } Loader { id : chLoaderPage source : "rsmfile:///Content/ChPageTest.ui.qml" // if true, everthing ok !!! //asynchronous: true onLoaded: { item.chRSM = chRSM; } }
QNetworkAccessManager* CChQMLRSMNetworkAccessManagerFactory::create( QObject* ChParent) { // dead lock occurs here, cause'f m_ChQMLRSM is in main thread and locked ! m_ChQMLRSM->ChGetSessionInfo(); .... }
-
@VeNToR said in QThread & QMutex:
ck always returns true.
Hi @VeNToR!
By chance is your mutex created using QMutex::Recursive and are you using tryLock in the same thread?
from QMutex documentation:
"Calling this function multiple times on the same mutex from the same thread is allowed if this mutex is a recursive mutex. If this mutex is a non-recursive mutex, this function will always return false when attempting to lock the mutex recursively."