Qt is open source; the details are in the source code.
A quick look shows that QMutex is implemented using platform-specific operating system calls and QAtomicInt, which in turn is implemented using platform/compiler-specific code (for example, some inline assembly code is used under Windows/MinGW). At that point it’s beyond my understanding, but that’s where you’ll have to look if you want to know, in detail, why it’s thread-safe.
QMutexLocker is a convenience for managing a QMutex using the RAII paradigm. The QMutexLocker constructor is not atomic, but it will block at the point where it tries to lock the associated QMutex if another thread has already locked the QMutex, because the call to QMutex::lock within the QMutexLocker constructor will block and wait until the lock has been released.
Bookmarks