QMutex is now just a pointer
authorOlivier Goffart <olivier.goffart@nokia.com>
Sat, 2 Jul 2011 13:13:12 +0000 (15:13 +0200)
committerQt by Nokia <qt-info@nokia.com>
Fri, 29 Jul 2011 08:32:07 +0000 (10:32 +0200)
commit86a237929e2b67ce333b635b760e78c628effb60
tree290ad9a01a9bcf19ef02f4455728823d136b7193
parent487583459ea7958f24cd579888a662bcce26caf3
QMutex is now just a pointer

And added a POD QBasicMutex. (QBasicMutex* can safely be
static_cast'ed to QMutex*)

The d pointer is not anymore always a QMutexPrivate.

If d == 0x0: the mutex is unlocked
If d == 0x1: the mutex is locked, uncontended

On linux:
if d == 0x3: the mutex is locked contended, waiting on a futex
If d is a pointer, it is a recursive mutex.

On non-linux platforms:
When a thread tries to lock a mutex for which d == 0x1, it will try to
assing it a QMutexPrivated (allocated from a freelist) in order to wait
for it.

Change-Id: Ie1431cd9402a576fdd9a693cfd747166eebf5622
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-on: http://codereview.qt.nokia.com/2116
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
14 files changed:
src/corelib/kernel/qobject.cpp
src/corelib/thread/qmutex.cpp
src/corelib/thread/qmutex.h
src/corelib/thread/qmutex_linux.cpp [new file with mode: 0644]
src/corelib/thread/qmutex_mac.cpp [new file with mode: 0644]
src/corelib/thread/qmutex_p.h
src/corelib/thread/qmutex_unix.cpp
src/corelib/thread/qmutex_win.cpp
src/corelib/thread/qorderedmutexlocker_p.h
src/corelib/thread/qwaitcondition_unix.cpp
src/corelib/thread/qwaitcondition_win.cpp
src/corelib/thread/thread.pri
tests/auto/qmutex/tst_qmutex.cpp
tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp