diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2011-07-02 15:13:12 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-07-29 10:32:07 +0200 |
commit | 86a237929e2b67ce333b635b760e78c628effb60 (patch) | |
tree | 290ad9a01a9bcf19ef02f4455728823d136b7193 /src/corelib/kernel/qobject.cpp | |
parent | 487583459ea7958f24cd579888a662bcce26caf3 (diff) |
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>
Diffstat (limited to 'src/corelib/kernel/qobject.cpp')
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 27edbdacac..ab9314ce53 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -878,7 +878,7 @@ QObject::~QObject() if (c->next) c->next->prev = c->prev; } if (needToUnlock) - m->unlockInline(); + m->unlock(); connectionList.first = c->nextConnectionList; delete c; @@ -902,7 +902,7 @@ QObject::~QObject() bool needToUnlock = QOrderedMutexLocker::relock(signalSlotMutex, m); //the node has maybe been removed while the mutex was unlocked in relock? if (!node || node->sender != sender) { - m->unlockInline(); + m->unlock(); continue; } node->receiver = 0; @@ -912,7 +912,7 @@ QObject::~QObject() node = node->next; if (needToUnlock) - m->unlockInline(); + m->unlock(); } } @@ -3076,7 +3076,7 @@ bool QMetaObjectPrivate::disconnectHelper(QObjectPrivate::Connection *c, } if (needToUnlock) - receiverMutex->unlockInline(); + receiverMutex->unlock(); c->receiver = 0; |