summaryrefslogtreecommitdiff
path: root/atomic
diff options
context:
space:
mode:
authorwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2005-05-16 21:48:29 +0000
committerwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2005-05-16 21:48:29 +0000
commit9ed3be9fdffc39e1da41008022f3200175b2e3dc (patch)
tree22cc20f31fdf287df66a097f7329956d11329e29 /atomic
parentb3a945116e23f79ed990cb83e98941955874a5e4 (diff)
downloadlibapr-9ed3be9fdffc39e1da41008022f3200175b2e3dc.tar.gz
These operations are NOT necessarily function-based on 64 bit
architectures. Performed with inline code, these function cast wrappers broke our API. These original flavors should be present for all 64 bit compiler headers. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@170467 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'atomic')
-rw-r--r--atomic/win32/apr_atomic.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/atomic/win32/apr_atomic.c b/atomic/win32/apr_atomic.c
index dd00abd93..95db7503b 100644
--- a/atomic/win32/apr_atomic.c
+++ b/atomic/win32/apr_atomic.c
@@ -63,17 +63,29 @@ APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val)
APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem)
{
/* we return old value, win32 returns new value :( */
+#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
+ return InterlockedIncrement(mem) - 1;
+#else
return ((apr_atomic_win32_ptr_fn)InterlockedIncrement)(mem) - 1;
+#endif
}
APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem)
{
+#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
+ return InterlockedDecrement(mem);
+#else
return ((apr_atomic_win32_ptr_fn)InterlockedDecrement)(mem);
+#endif
}
APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
+#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
+ InterlockedExchange(mem, val);
+#else
((apr_atomic_win32_ptr_val_fn)InterlockedExchange)(mem, val);
+#endif
}
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem)
@@ -84,7 +96,11 @@ APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem)
APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with,
apr_uint32_t cmp)
{
+#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
+ return InterlockedCompareExchange(mem, with, cmp);
+#else
return ((apr_atomic_win32_ptr_val_val_fn)InterlockedCompareExchange)(mem, with, cmp);
+#endif
}
APR_DECLARE(void *) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
@@ -99,5 +115,9 @@ APR_DECLARE(void *) apr_atomic_casptr(volatile void **mem, void *with, const voi
APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val)
{
+#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
+ return InterlockedExchange(mem, val);
+#else
return ((apr_atomic_win32_ptr_val_fn)InterlockedExchange)(mem, val);
+#endif
}