diff options
author | William A. Rowe Jr <wrowe@apache.org> | 2004-04-16 13:54:19 +0000 |
---|---|---|
committer | William A. Rowe Jr <wrowe@apache.org> | 2004-04-16 13:54:19 +0000 |
commit | 2283471ec957bf9df0b3bfbc63a0542b09a2bc16 (patch) | |
tree | f0d609a298317feb1d1dcd02944c19022de442a2 /atomic/win32 | |
parent | cc120f208ac65bcaaaa41d6fb2da5d2704ff2eab (diff) | |
download | apr-2283471ec957bf9df0b3bfbc63a0542b09a2bc16.tar.gz |
Quiet build breakage on VC6 with the originally shipped includes
(InterlockedCompareExchangePointer available in later SDK headers.)
Few should be compiling on 64 bit cpu's under VC6 anymore, so ignore
that edge case.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65063 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'atomic/win32')
-rw-r--r-- | atomic/win32/apr_atomic.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/atomic/win32/apr_atomic.c b/atomic/win32/apr_atomic.c index 5ca8145af..d83d60c89 100644 --- a/atomic/win32/apr_atomic.c +++ b/atomic/win32/apr_atomic.c @@ -22,11 +22,6 @@ APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p) return APR_SUCCESS; } -APR_DECLARE(void *) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp) -{ - return InterlockedCompareExchangePointer(mem, with, cmp); -} - /* * Remapping function pointer type to accept apr_uint32_t's type-safely * as the arguments for as our apr_atomic_foo32 Functions @@ -39,12 +34,18 @@ typedef WINBASEAPI apr_uint32_t (WINAPI * apr_atomic_win32_ptr_val_fn) typedef WINBASEAPI apr_uint32_t (WINAPI * apr_atomic_win32_ptr_val_val_fn) (apr_uint32_t volatile *, apr_uint32_t, apr_uint32_t); +typedef WINBASEAPI void * (WINAPI * apr_atomic_win32_ptr_ptr_ptr_fn) + (volatile void **, + void *, const void *); APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val) { return ((apr_atomic_win32_ptr_val_fn)InterlockedExchangeAdd)(mem, val); } +/* Of course we want the 2's compliment of the unsigned value, val */ +#pragma warning(disable: 4146) + APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val) { ((apr_atomic_win32_ptr_val_fn)InterlockedExchangeAdd)(mem, -val); @@ -77,6 +78,16 @@ APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint3 return ((apr_atomic_win32_ptr_val_val_fn)InterlockedCompareExchange)(mem, with, cmp); } +APR_DECLARE(void *) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp) +{ +#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED) + return InterlockedCompareExchangePointer(mem, with, cmp); +#else + /* Too many VC6 users have stale win32 API files, stub this */ + return ((apr_atomic_win32_ptr_ptr_ptr_fn)InterlockedCompareExchange)(mem, with, cmp); +#endif +} + APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val) { return ((apr_atomic_win32_ptr_val_fn)InterlockedExchange)(mem, val); |