summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qmutex.h
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-03-10 14:16:17 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-03-10 14:16:17 (GMT)
commit727ec8c564a3947784bfe371b39615f965d530ec (patch)
treed4360972a21f8d24214b7a0c5ec7277391479192 /src/corelib/thread/qmutex.h
parentef9e7168a8ed3e8149204cf6c604a38db35245c0 (diff)
parent01a045084ad45da37e6b79938354c82419c0a83e (diff)
downloadQt-727ec8c564a3947784bfe371b39615f965d530ec.zip
Qt-727ec8c564a3947784bfe371b39615f965d530ec.tar.gz
Qt-727ec8c564a3947784bfe371b39615f965d530ec.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7
Diffstat (limited to 'src/corelib/thread/qmutex.h')
-rw-r--r--src/corelib/thread/qmutex.h15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/corelib/thread/qmutex.h b/src/corelib/thread/qmutex.h
index 80b50fc..677412e 100644
--- a/src/corelib/thread/qmutex.h
+++ b/src/corelib/thread/qmutex.h
@@ -95,7 +95,7 @@ class Q_CORE_EXPORT QMutexLocker
{
public:
inline explicit QMutexLocker(QMutex *m)
- : mtx(m)
+ : val(reinterpret_cast<quintptr>(m))
{
Q_ASSERT_X((val & quintptr(1u)) == quintptr(0),
"QMutexLocker", "QMutex pointer is misaligned");
@@ -105,19 +105,19 @@ public:
inline void unlock()
{
- if (mtx) {
+ if (val) {
if ((val & quintptr(1u)) == quintptr(1u)) {
val &= ~quintptr(1u);
- mtx->unlock();
+ mutex()->unlock();
}
}
}
inline void relock()
{
- if (mtx) {
+ if (val) {
if ((val & quintptr(1u)) == quintptr(0u)) {
- mtx->lock();
+ mutex()->lock();
val |= quintptr(1u);
}
}
@@ -140,10 +140,7 @@ public:
private:
Q_DISABLE_COPY(QMutexLocker)
- union {
- QMutex *mtx;
- quintptr val;
- };
+ quintptr val;
};
#else // QT_NO_THREAD