49 #define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE
56 #define Q_ATOMIC_INT_TEST_AND_SET_IS_NOT_NATIVE
63 #define Q_ATOMIC_INT_FETCH_AND_STORE_IS_NOT_NATIVE
70 #define Q_ATOMIC_INT_FETCH_AND_ADD_IS_NOT_NATIVE
77 #define Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE
86 #define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_NOT_NATIVE
95 #define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NOT_NATIVE
100 template <
typename T>
110 asm volatile(
"tas.b @%2\n"
112 :
"=&r"(ret),
"=m"(*ptr)
127 return originalValue != -1;
137 return originalValue != 1;
144 bool returnValue =
false;
181 return originalValue;
209 return originalValue;
229 template <
typename T>
232 bool returnValue =
false;
236 if (_q_value == expectedValue) {
244 template <
typename T>
247 return testAndSetOrdered(expectedValue, newValue);
250 template <
typename T>
253 return testAndSetOrdered(expectedValue, newValue);
256 template <
typename T>
259 return testAndSetOrdered(expectedValue, newValue);
264 template <
typename T>
270 T *originalValue = _q_value;
273 return originalValue;
276 template <
typename T>
279 return fetchAndStoreOrdered(newValue);
282 template <
typename T>
285 return fetchAndStoreOrdered(newValue);
288 template <
typename T>
291 return fetchAndStoreOrdered(newValue);
296 template <
typename T>
302 T *originalValue = (_q_value);
303 _q_value += valueToAdd;
305 return originalValue;
308 template <
typename T>
311 return fetchAndAddOrdered(valueToAdd);
314 template <
typename T>
317 return fetchAndAddOrdered(valueToAdd);
320 template <
typename T>
323 return fetchAndAddOrdered(valueToAdd);
330 #endif // QATOMIC_SH_H
int fetchAndStoreRelaxed(int newValue)
bool testAndSetRelease(int expectedValue, int newValue)
static bool isFetchAndAddNative()
T * fetchAndAddAcquire(qptrdiff valueToAdd)
T * fetchAndAddOrdered(qptrdiff valueToAdd)
static bool isReferenceCountingNative()
int fetchAndAddRelaxed(int valueToAdd)
T * fetchAndStoreAcquire(T *newValue)
T * fetchAndAddRelease(qptrdiff valueToAdd)
int fetchAndAddAcquire(int valueToAdd)
static bool isReferenceCountingWaitFree()
T * fetchAndAddRelaxed(qptrdiff valueToAdd)
static bool isFetchAndAddNative()
bool testAndSetOrdered(T *expectedValue, T *newValue)
bool testAndSetAcquire(int expectedValue, int newValue)
static bool isFetchAndStoreNative()
#define QT_BEGIN_NAMESPACE
static bool isTestAndSetNative()
static bool isTestAndSetNative()
static bool isFetchAndStoreNative()
T * fetchAndStoreRelaxed(T *newValue)
static bool isFetchAndAddWaitFree()
bool testAndSetRelaxed(int expectedValue, int newValue)
Q_CORE_EXPORT void qt_atomic_yield(int *count)
T * fetchAndStoreRelease(T *newValue)
bool testAndSetRelease(T *expectedValue, T *newValue)
GLuint GLuint GLsizei count
int qt_atomic_tasb(volatile char *ptr)
static bool isFetchAndStoreWaitFree()
static bool isTestAndSetWaitFree()
bool testAndSetAcquire(T *expectedValue, T *newValue)
Q_CORE_EXPORT volatile char qt_atomic_lock
static bool isFetchAndAddWaitFree()
T * fetchAndStoreOrdered(T *newValue)
static bool isFetchAndStoreWaitFree()
bool testAndSetRelaxed(T *expectedValue, T *newValue)
int fetchAndStoreAcquire(int newValue)
static bool isTestAndSetWaitFree()
bool testAndSetOrdered(int expectedValue, int newValue)
int fetchAndAddOrdered(int valueToAdd)
int fetchAndStoreOrdered(int newValue)
int fetchAndAddRelease(int valueToAdd)
int fetchAndStoreRelease(int newValue)