Author: mturk
Date: Sat Jun 25 11:42:43 2011
New Revision: 1139527

URL: http://svn.apache.org/viewvc?rev=1139527&view=rev
Log:
Use inlines for win32 atomic operations

Removed:
    commons/sandbox/runtime/trunk/src/main/native/os/win32/atomic.c
Modified:
    commons/sandbox/runtime/trunk/src/main/native/os/win32/arch_sync.h

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/arch_sync.h
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/arch_sync.h?rev=1139527&r1=1139526&r2=1139527&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/arch_sync.h 
(original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/arch_sync.h Sat Jun 
25 11:42:43 2011
@@ -31,4 +31,50 @@
 #define USE_ATOMICS_WRAPPER     0
 #define USE_BUILTIN_ATOMICS     1
 
+ACR_INLINE(void) AcrCpuFence()
+{
+    _PR_COMPILER_FENCE();
+}
+
+ACR_INLINE(void) AcrMemoryFence()
+{
+    _PR_RWMEMORY_FENCE();
+}
+
+ACR_INLINE(int) AcrAtomic32Inc(volatile acr_atomic32_t *val)
+{
+    return (int)InterlockedIncrement(val);
+}
+
+ACR_INLINE(int) AcrAtomic32Dec(volatile acr_atomic32_t *val)
+{
+    return (int)InterlockedDecrement(val);
+}
+
+ACR_INLINE(int) AcrAtomic32Cas(volatile acr_atomic32_t *val, int cmp, int set)
+{
+    return (int)InterlockedCompareExchange(val, (long)cmp, (long)set);
+}
+
+ACR_INLINE(void *) AcrAtomic32CasPtr(void * volatile *val, const void *cmp, 
void *set)
+{
+    return InterlockedCompareExchangePointer(val, (void *)cmp, set);
+}
+
+ACR_INLINE(int) AcrAtomic32Set(volatile acr_atomic32_t *val, int num)
+{
+    return (int)InterlockedExchange(val, (long)num);
+}
+
+ACR_INLINE(void *) AcrAtomic32SetPtr(void * volatile *val, void *set)
+{
+    return InterlockedExchangePointer(val,  set);
+}
+
+ACR_INLINE(int) AcrAtomic32Equ(volatile acr_atomic32_t *val, int num)
+{
+    long cmp = (long)num;
+    return InterlockedCompareExchange(val, cmp, cmp) == cmp;
+}
+
 #endif /* _ACR_ARCH_SYNC_H_ */


Reply via email to