42 #ifndef QATOMIC_I386_H 43 #define QATOMIC_I386_H 48 #define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE 49 #define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_WAIT_FREE 56 #define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE 57 #define Q_ATOMIC_INT_TEST_AND_SET_IS_WAIT_FREE 64 #define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE 65 #define Q_ATOMIC_INT_FETCH_AND_STORE_IS_WAIT_FREE 72 #define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE 73 #define Q_ATOMIC_INT_FETCH_AND_ADD_IS_WAIT_FREE 80 #define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE 81 #define Q_ATOMIC_POINTER_TEST_AND_SET_IS_WAIT_FREE 90 #define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE 91 #define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_WAIT_FREE 100 #define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE 101 #define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_WAIT_FREE 103 template <
typename T>
106 template <
typename T>
110 #if defined(Q_CC_GNU) || defined(Q_CC_INTEL) 115 asm volatile(
"lock\n" 127 asm volatile(
"lock\n" 139 asm volatile(
"lock\n" 142 :
"=a" (newValue),
"=qm" (ret),
"+m" (
_q_value)
143 :
"r" (newValue),
"0" (expectedValue)
150 asm volatile(
"xchgl %0,%1" 159 asm volatile(
"lock\n" 161 :
"=r" (valueToAdd),
"+m" (
_q_value)
167 template <
typename T>
171 asm volatile(
"lock\n" 174 :
"=a" (newValue),
"=qm" (ret),
"+m" (
_q_value)
175 :
"r" (newValue),
"0" (expectedValue)
180 template <
typename T>
183 asm volatile(
"xchgl %0,%1" 190 template <
typename T>
193 asm volatile(
"lock\n" 195 :
"=r" (valueToAdd),
"+m" (
_q_value)
196 :
"0" (valueToAdd *
sizeof(T))
198 return reinterpret_cast<T *
>(valueToAdd);
239 template <
typename T>
245 template <
typename T>
251 template <
typename T>
304 template <
typename T>
310 template <
typename T>
316 template <
typename T>
322 template <
typename T>
328 template <
typename T>
334 template <
typename T>
340 template <
typename T>
346 template <
typename T>
352 template <
typename T>
361 #endif // QATOMIC_I386_H static bool isFetchAndStoreNative()
static bool isTestAndSetNative()
int fetchAndStoreRelease(int newValue)
static bool isReferenceCountingNative()
T * fetchAndAddRelaxed(qptrdiff valueToAdd)
#define QT_END_NAMESPACE
This macro expands to.
static bool isFetchAndAddNative()
static bool isTestAndSetNative()
Q_CORE_EXPORT int q_atomic_increment(volatile int *ptr)
static bool isFetchAndAddNative()
T * fetchAndStoreRelease(T *newValue)
static bool isTestAndSetWaitFree()
Q_CORE_EXPORT int q_atomic_test_and_set_int(volatile int *ptr, int expected, int newval)
Q_CORE_EXPORT void * q_atomic_fetch_and_add_ptr(volatile void *ptr, int value)
T * fetchAndAddRelease(qptrdiff valueToAdd)
bool testAndSetOrdered(T *expectedValue, T *newValue)
int fetchAndAddAcquire(int valueToAdd)
T * fetchAndAddAcquire(qptrdiff valueToAdd)
int fetchAndStoreRelaxed(int newValue)
T * fetchAndAddOrdered(qptrdiff valueToAdd)
bool testAndSetAcquire(int expectedValue, int newValue)
Q_CORE_EXPORT int q_atomic_fetch_and_add_int(volatile int *ptr, int value)
bool testAndSetRelaxed(int expectedValue, int newValue)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Q_CORE_EXPORT int q_atomic_test_and_set_ptr(volatile void *ptr, const void *expected, const void *newval)
int fetchAndStoreAcquire(int newValue)
QIntegerForSizeof< void * >::Signed qptrdiff
T * fetchAndStoreOrdered(T *newValue)
Q_CORE_EXPORT int q_atomic_decrement(volatile int *ptr)
#define Q_INLINE_TEMPLATE
int fetchAndAddRelease(int valueToAdd)
const T * ptr(const T &t)
bool testAndSetOrdered(int expectedValue, int newValue)
T * fetchAndStoreAcquire(T *newValue)
Q_CORE_EXPORT int q_atomic_set_int(volatile int *ptr, int newval)
static bool isFetchAndStoreWaitFree()
static bool isTestAndSetWaitFree()
static bool isReferenceCountingWaitFree()
int fetchAndAddOrdered(int valueToAdd)
static bool isFetchAndStoreWaitFree()
static bool isFetchAndAddWaitFree()
static bool isFetchAndAddWaitFree()
bool testAndSetRelease(int expectedValue, int newValue)
Q_CORE_EXPORT void * q_atomic_set_ptr(volatile void *ptr, void *newval)
int fetchAndAddRelaxed(int valueToAdd)
int fetchAndStoreOrdered(int newValue)
bool testAndSetRelaxed(T *expectedValue, T *newValue)
bool testAndSetRelease(T *expectedValue, T *newValue)
T * fetchAndStoreRelaxed(T *newValue)
static bool isFetchAndStoreNative()
bool testAndSetAcquire(T *expectedValue, T *newValue)