Compatibility Members for QMutex
The following members of class QMutexare part of the Qt compatibility layer. We advise against using them in new code.
Public Functions
Member Function Documentation
QMutex::QMutex(bool recursive)
Use the constructor that takes a RecursionMode parameter instead.
bool QMutex::locked()
Returns true if the mutex is locked by another thread; otherwise returns false.
It is generally a bad idea to use this function, because code that uses it has a race condition. Use tryLock() and unlock() instead.
For example, if you have code like
bool isLocked = mutex.locked();
you can rewrite it as
bool isLocked = true; if (mutex.tryLock()) { mutex.unlock(); isLocked = false; }
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.