summaryrefslogtreecommitdiffstats
path: root/src/corelib/arch/qatomic_gcc.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/arch/qatomic_gcc.h')
-rw-r--r--src/corelib/arch/qatomic_gcc.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/corelib/arch/qatomic_gcc.h b/src/corelib/arch/qatomic_gcc.h
index 052453c082..5184293465 100644
--- a/src/corelib/arch/qatomic_gcc.h
+++ b/src/corelib/arch/qatomic_gcc.h
@@ -113,6 +113,17 @@ template <typename X> struct QAtomicOps: QGenericAtomicOps<QAtomicOps<X> >
}
template <typename T>
+ static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) Q_DECL_NOTHROW
+ {
+ bool tmp = __sync_bool_compare_and_swap(&_q_value, expectedValue, newValue);
+ if (tmp)
+ *currentValue = expectedValue;
+ else
+ *currentValue = _q_value;
+ return tmp;
+ }
+
+ template <typename T>
static T fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW
{
return __sync_lock_test_and_set(&_q_value, newValue);