40 #include "../../rtt-config.h" 41 #ifndef __ARCH_MSVC_ORO_ATOMIC__ 42 #define __ARCH_MSVC_ORO_ATOMIC__ 50 #define ORO_ATOMIC_SETUP oro_atomic_set 51 #define ORO_ATOMIC_CLEANUP(a_int) 53 #define oro_atomic_read(a_int) (*(a_int)) 55 #define oro_atomic_set(a_int,n) (*(a_int) = (n)) 59 _InterlockedExchangeAdd((
long *)a_int, n);
69 return ((_InterlockedExchangeAdd((
long *)a_int, -n) - n) == 0);
74 _InterlockedIncrement((
long *)a_int);
79 _InterlockedDecrement((
long *)a_int);
84 return (_InterlockedDecrement((
long *)a_int) == 0);
89 return (_InterlockedIncrement((
long *)a_int) == 0);
94 return ((_InterlockedExchangeAdd((
long *)a_int, n) + n) < 0);
99 return _InterlockedExchangeAdd((
long *)a_int, n) + n;
109 return _InterlockedIncrement((
long *)a_int);
114 return _InterlockedDecrement((
long *)a_int);
119 return _InterlockedAnd((
long *)a_int, ~mask);
124 return _InterlockedOr((
long *)a_int, mask);
127 #pragma warning(push) 128 #pragma warning(disable : 4715) // Disable warning on "specified function can potentially not return a value" 130 template<
typename T>
inline T
oro_cmpxchg(
volatile void * ptr, T old, T _new)
135 return (T)(_InterlockedCompareExchange16((
short *)ptr, (
short)_new, (
short)old));
137 return (T)(_InterlockedCompareExchange((
long *)ptr, (
long)_new, (
long)old));
139 return (T)(_InterlockedCompareExchange64((__int64 *)ptr, (__int64)_new, (__int64)old));
static __forceinline int oro_atomic_inc_return(oro_atomic_t *a_int)
static __forceinline void oro_atomic_add(oro_atomic_t *a_int, int n)
static __forceinline void oro_atomic_dec(oro_atomic_t *a_int)
static __forceinline int oro_atomic_dec_and_test(oro_atomic_t *a_int)
static __forceinline void oro_atomic_sub(oro_atomic_t *a_int, int n)
static __forceinline int oro_atomic_add_negative(oro_atomic_t *a_int, int n)
volatile long oro_atomic_t
static __forceinline int oro_atomic_inc_and_test(oro_atomic_t *a_int)
static __forceinline int oro_atomic_sub_return(oro_atomic_t *a_int, int n)
static __forceinline int oro_atomic_set_mask(oro_atomic_t *a_int, int mask)
static __forceinline int oro_atomic_sub_and_test(oro_atomic_t *a_int, int n)
static __forceinline int oro_atomic_dec_return(oro_atomic_t *a_int)
static __forceinline int oro_atomic_clear_mask(oro_atomic_t *a_int, int mask)
static __forceinline int oro_atomic_add_return(oro_atomic_t *a_int, int n)
T oro_cmpxchg(volatile void *ptr, T old, T _new)
static __forceinline void oro_atomic_inc(oro_atomic_t *a_int)