diff options
author | Rolland Dudemaine <rolland@ghs.com> | 2011-11-15 16:28:11 (GMT) |
---|---|---|
committer | Harald Fernengel <harald.fernengel@nokia.com> | 2011-11-15 16:28:11 (GMT) |
commit | f94eea0176e7ecd2c9c6a748259e08a4361d9478 (patch) | |
tree | 5608ff0792e553d1d9f13e810bdbb95b0179c41e /src/corelib/arch | |
parent | fba5fce6723a739aec73ef5184ccb6cc425402fe (diff) | |
download | Qt-f94eea0176e7ecd2c9c6a748259e08a4361d9478.zip Qt-f94eea0176e7ecd2c9c6a748259e08a4361d9478.tar.gz Qt-f94eea0176e7ecd2c9c6a748259e08a4361d9478.tar.bz2 |
Resolve atomic operations issues on INTEGRITY.
Now passes atomicpointer autotest successfully.
Merge-request: 1438
Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com>
Diffstat (limited to 'src/corelib/arch')
-rw-r--r-- | src/corelib/arch/qatomic_integrity.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/arch/qatomic_integrity.h b/src/corelib/arch/qatomic_integrity.h index f957297..c72a48d 100644 --- a/src/corelib/arch/qatomic_integrity.h +++ b/src/corelib/arch/qatomic_integrity.h @@ -203,7 +203,7 @@ inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) template <typename T> Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) { - return TestAndSet((Address*)&_q_value, qt_addr(expectedValue), qt_addr(newValue)) == Success; + return TestAndSet(reinterpret_cast<Address *>(const_cast<T **>(&_q_value)), qt_addr(expectedValue), qt_addr(newValue)) == Success; } template <typename T> @@ -231,7 +231,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) { Address old_val; do { - old_val = *reinterpret_cast<Address *>(const_cast<T *>(newValue)); + old_val = *reinterpret_cast<Address *>(const_cast<T *>(_q_value)); } while (TestAndSet(reinterpret_cast<Address *>(const_cast<T **>(&_q_value)), old_val, qt_addr(newValue)) != Success); return reinterpret_cast<T *>(old_val); } @@ -259,7 +259,8 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) { - AtomicModify(qt_p2addr(&_q_value), qt_addr(_q_value), qt_addr(_q_value) + valueToAdd * sizeof(T)); + Address old_value; + AtomicModify(reinterpret_cast<volatile Address*>(&_q_value), &old_value, 0, valueToAdd * sizeof(T)); return _q_value; } |