diff options
author | Thiago Macieira <thiago@kde.org> | 2011-07-05 23:46:19 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-03 07:57:41 +0200 |
commit | 5bfeab8749ce6820d55135b81665a7231d3b1504 (patch) | |
tree | 152569571114c53d4cdfaa0013307267cb3379a6 /src/corelib/thread/qmutex_linux.cpp | |
parent | 5613c9722adee921e16682c0a035f2a7567bd346 (diff) |
Make all uses of QBasicAtomicInt and Pointer use load() and store()
Most of these changes are search-and-replace of d->ref ==, d->ref !=
and d->ref =.
The QBasicAtomicPointer in QObjectPrivate::Connection didn't need to
be basic, so I made it QAtomicPointer.
Change-Id: Ie3271abd1728af599f9ab17c6f4868e475f17bb6
Reviewed-on: http://codereview.qt-project.org/5030
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/corelib/thread/qmutex_linux.cpp')
-rw-r--r-- | src/corelib/thread/qmutex_linux.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/corelib/thread/qmutex_linux.cpp b/src/corelib/thread/qmutex_linux.cpp index 17015b8f84..a3ca150a31 100644 --- a/src/corelib/thread/qmutex_linux.cpp +++ b/src/corelib/thread/qmutex_linux.cpp @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE -static inline int _q_futex(QMutexPrivate *volatile *addr, int op, int val, const struct timespec *timeout) +static inline int _q_futex(void *addr, int op, int val, const struct timespec *timeout) { volatile int *int_addr = reinterpret_cast<volatile int *>(addr); #if Q_BYTE_ORDER == Q_BIG_ENDIAN && QT_POINTER_SIZE == 8 @@ -82,7 +82,7 @@ bool QBasicMutex::lockInternal(int timeout) elapsedTimer.start(); while (!fastTryLock()) { - QMutexPrivate *d = this->d; + QMutexPrivate *d = this->d.load(); if (!d) // if d is 0, the mutex is unlocked continue; @@ -103,7 +103,7 @@ bool QBasicMutex::lockInternal(int timeout) ts.tv_nsec = xtimeout % (Q_INT64_C(1000) * 1000 * 1000); pts = &ts; } - int r = _q_futex(&this->d._q_value, FUTEX_WAIT, quintptr(dummyFutexValue()), pts); + int r = _q_futex(&this->d, FUTEX_WAIT, quintptr(dummyFutexValue()), pts); if (r != 0 && errno == ETIMEDOUT) return false; } @@ -112,19 +112,19 @@ bool QBasicMutex::lockInternal(int timeout) Q_ASSERT(d->recursive); return static_cast<QRecursiveMutexPrivate *>(d)->lock(timeout); } - Q_ASSERT(this->d); + Q_ASSERT(this->d.load()); return true; } void QBasicMutex::unlockInternal() { - QMutexPrivate *d = this->d; + QMutexPrivate *d = this->d.load(); Q_ASSERT(d); //we must be locked Q_ASSERT(d != dummyLocked()); // testAndSetRelease(dummyLocked(), 0) failed if (d == dummyFutexValue()) { this->d.fetchAndStoreRelease(0); - _q_futex(&this->d._q_value, FUTEX_WAKE, 1, 0); + _q_futex(&this->d, FUTEX_WAKE, 1, 0); return; } |