summaryrefslogtreecommitdiff
path: root/atomic
diff options
context:
space:
mode:
authorwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2004-04-16 13:54:19 +0000
committerwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2004-04-16 13:54:19 +0000
commit9e051123fc927725195ab6c7947bae26a4a9079c (patch)
treef0d609a298317feb1d1dcd02944c19022de442a2 /atomic
parentbed5128c81dce01b6370b67e666d444a1939ef61 (diff)
downloadlibapr-9e051123fc927725195ab6c7947bae26a4a9079c.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: http://svn.apache.org/repos/asf/apr/apr/trunk@65063 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'atomic')
-rw-r--r--atomic/win32/apr_atomic.c21
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);