diff options
author | William A. Rowe Jr <wrowe@apache.org> | 2005-05-16 21:48:29 +0000 |
---|---|---|
committer | William A. Rowe Jr <wrowe@apache.org> | 2005-05-16 21:48:29 +0000 |
commit | fa2fde93154ca9e2e5b63fc6b288fef3880a1962 (patch) | |
tree | 22cc20f31fdf287df66a097f7329956d11329e29 /atomic | |
parent | 9f6cc12df13f8c761aef6b5a7a16db1e7d914637 (diff) | |
download | apr-fa2fde93154ca9e2e5b63fc6b288fef3880a1962.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: https://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.c | 20 |
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 } |