The upstream commit looks at least semi-sane -- it looks like the memory barrier stuff is merged in lp:ubuntu/qt4-x11, is my understanding correct?
I also generally agree with upstream's view that they don't want to port to the GCC primitives: since Qt already has a pretty decent atomics API, and since the GCC atomics are crude by comparison, it probably doesn't make sense to re-port Qt to the GCC atomics for the sake of it, providing the code works.
I'm uncertain whether some of the "Ordered" primitives really are ordered though:
In QBasicAtomicInt::testAndSetOrdered(int,int), I can't see why we don't need Q_DATA_MEMORY_BARRIER after calling testAndSetRelaxed(); or otherwise why we don't need to call testAndSetAcquire() to get that barrier implicitly (as is done for QBasicAtomicPointer<T>::testAndSetOrdered(T *,T *)).
The upstream commit looks at least semi-sane -- it looks like the memory barrier stuff is merged in lp:ubuntu/qt4-x11, is my understanding correct?
I also generally agree with upstream's view that they don't want to port to the GCC primitives: since Qt already has a pretty decent atomics API, and since the GCC atomics are crude by comparison, it probably doesn't make sense to re-port Qt to the GCC atomics for the sake of it, providing the code works.
I'm uncertain whether some of the "Ordered" primitives really are ordered though:
Compare:
src/corelib/ arch/qatomic_ armv6.h: 429: ::testAndSetOrd ered(int expectedValue, int newValue) MEMORY_ BARRIER; ed(expectedValu e, newValue); MEMORY_ BARRIER;
inline bool QBasicAtomicInt
{
Q_DATA_
bool returnValue = testAndSetRelax
Q_COMPILER_
return returnValue;
}
src/corelib/ arch/qatomic_ armv6.h: 495: nter<T> ::testAndSetOrd ered(T *expectedValue, T *newValue) MEMORY_ BARRIER; re(expectedValu e, newValue); MEMORY_ BARRIER;
template <typename T>
Q_INLINE_TEMPLATE bool QBasicAtomicPoi
{
Q_DATA_
bool returnValue = testAndSetAcqui
Q_COMPILER_
return returnValue;
}
In QBasicAtomicInt ::testAndSetOrd ered(int, int), I can't see why we don't need Q_DATA_ MEMORY_ BARRIER after calling testAndSetRelax ed(); or otherwise why we don't need to call testAndSetAcquire() to get that barrier implicitly (as is done for QBasicAtomicPoi nter<T> ::testAndSetOrd ered(T *,T *)).