apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject svn commit: r422168 - /apr/apr/trunk/atomic/win32/apr_atomic.c
Date Sat, 15 Jul 2006 07:40:40 GMT
Author: pquerna
Date: Sat Jul 15 00:40:39 2006
New Revision: 422168

URL: http://svn.apache.org/viewvc?rev=422168&view=rev
Log:
Add __MINGW32__ versions of the Win32 Atomic functions, that all do their own evil casting
-- but it allows 100% of the testatomic cases to pass, when previously, it aborted if you
tried to call any of the atomic functions.

Modified:
    apr/apr/trunk/atomic/win32/apr_atomic.c

Modified: apr/apr/trunk/atomic/win32/apr_atomic.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/atomic/win32/apr_atomic.c?rev=422168&r1=422167&r2=422168&view=diff
==============================================================================
--- apr/apr/trunk/atomic/win32/apr_atomic.c (original)
+++ apr/apr/trunk/atomic/win32/apr_atomic.c Sat Jul 15 00:40:39 2006
@@ -43,6 +43,8 @@
 {
 #if (defined(_M_IA64) || defined(_M_AMD64))
     return InterlockedExchangeAdd(mem, val);
+#elif defined(__MINGW32__)
+    return InterlockedExchangeAdd((long *)mem, val);
 #else
     return ((apr_atomic_win32_ptr_val_fn)InterlockedExchangeAdd)(mem, val);
 #endif
@@ -55,6 +57,8 @@
 {
 #if (defined(_M_IA64) || defined(_M_AMD64))
     InterlockedExchangeAdd(mem, -val);
+#elif defined(__MINGW32__)
+    InterlockedExchangeAdd((long *)mem, -val);
 #else
     ((apr_atomic_win32_ptr_val_fn)InterlockedExchangeAdd)(mem, -val);
 #endif
@@ -65,6 +69,8 @@
     /* we return old value, win32 returns new value :( */
 #if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
     return InterlockedIncrement(mem) - 1;
+#elif defined(__MINGW32__)
+    return InterlockedIncrement((long *)mem) - 1;
 #else
     return ((apr_atomic_win32_ptr_fn)InterlockedIncrement)(mem) - 1;
 #endif
@@ -74,6 +80,8 @@
 {
 #if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
     return InterlockedDecrement(mem);
+#elif defined(__MINGW32__)
+    return InterlockedDecrement((long *)mem);
 #else
     return ((apr_atomic_win32_ptr_fn)InterlockedDecrement)(mem);
 #endif
@@ -83,6 +91,8 @@
 {
 #if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
     InterlockedExchange(mem, val);
+#elif defined(__MINGW32__)
+    InterlockedExchange((long*)mem, val);
 #else
     ((apr_atomic_win32_ptr_val_fn)InterlockedExchange)(mem, val);
 #endif
@@ -98,6 +108,8 @@
 {
 #if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
     return InterlockedCompareExchange(mem, with, cmp);
+#elif defined(__MINGW32__)
+    return InterlockedCompareExchange((long*)mem, with, cmp);
 #else
     return ((apr_atomic_win32_ptr_val_val_fn)InterlockedCompareExchange)(mem, with, cmp);
 #endif
@@ -105,7 +117,7 @@
 
 APR_DECLARE(void *) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
 {
-#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
+#if (defined(_M_IA64) || defined(_M_AMD64) || defined(__MINGW32__)) && !defined(RC_INVOKED)
     return InterlockedCompareExchangePointer((void**)mem, with, (void*)cmp);
 #else
     /* Too many VC6 users have stale win32 API files, stub this */
@@ -117,6 +129,8 @@
 {
 #if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
     return InterlockedExchange(mem, val);
+#elif defined(__MINGW32__)
+    return InterlockedExchange((long *)mem, val);
 #else
     return ((apr_atomic_win32_ptr_val_fn)InterlockedExchange)(mem, val);
 #endif



Mime
View raw message