X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Futils%2Fatomic.h;h=306800cfe1d0cd508a56aafb341a815de949233c;hb=f0d2ee46f839cc3cebcdaa674b3a31d9a3e22863;hp=c8c70007bc751d0a55d612c230a28450c79e968f;hpb=c39718bbb394fe97281e6e64945b4572bef29121;p=mono.git diff --git a/mono/utils/atomic.h b/mono/utils/atomic.h index c8c70007bc7..306800cfe1d 100755 --- a/mono/utils/atomic.h +++ b/mono/utils/atomic.h @@ -108,13 +108,19 @@ static inline gint64 InterlockedAdd64(volatile gint64 *dest, gint64 add) #endif #endif +#ifdef HOST_WIN32 +#define TO_INTERLOCKED_ARGP(ptr) ((volatile LONG*)(ptr)) +#else +#define TO_INTERLOCKED_ARGP(ptr) (ptr) +#endif + /* And now for some dirty hacks... The Windows API doesn't * provide any useful primitives for this (other than getting * into architecture-specific madness), so use CAS. */ static inline gint32 InterlockedRead(volatile gint32 *src) { - return InterlockedCompareExchange (src, 0, 0); + return InterlockedCompareExchange (TO_INTERLOCKED_ARGP (src), 0, 0); } static inline gint64 InterlockedRead64(volatile gint64 *src) @@ -129,7 +135,7 @@ static inline gpointer InterlockedReadPointer(volatile gpointer *src) static inline void InterlockedWrite(volatile gint32 *dst, gint32 val) { - InterlockedExchange (dst, val); + InterlockedExchange (TO_INTERLOCKED_ARGP (dst), val); } static inline void InterlockedWrite64(volatile gint64 *dst, gint64 val) @@ -167,7 +173,7 @@ static inline void InterlockedWrite16(volatile gint16 *dst, gint16 val) mono_memory_barrier (); } -/* Prefer GCC atomic ops if the target supports it (see configure.in). */ +/* Prefer GCC atomic ops if the target supports it (see configure.ac). */ #elif defined(USE_GCC_ATOMIC_OPS) static inline gint32 InterlockedCompareExchange(volatile gint32 *dest,