Updated Branches:
  refs/heads/msvc6 89fb1c49f -> ded3ae77f

Use InterlockedCompareExchange under 32-bit Windows


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/ded3ae77
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/ded3ae77
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/ded3ae77

Branch: refs/heads/msvc6
Commit: ded3ae77fafde4e2898b7e96763dbfd04f12f33d
Parents: 6c854a0
Author: Nick Wellnhofer <[email protected]>
Authored: Sun Nov 4 16:23:18 2012 +0100
Committer: Nick Wellnhofer <[email protected]>
Committed: Sun Nov 4 16:25:59 2012 +0100

----------------------------------------------------------------------
 clownfish/runtime/core/Clownfish/Util/Atomic.c |    5 +++++
 core/Clownfish/Util/Atomic.c                   |    5 +++++
 2 files changed, 10 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/ded3ae77/clownfish/runtime/core/Clownfish/Util/Atomic.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Util/Atomic.c 
b/clownfish/runtime/core/Clownfish/Util/Atomic.c
index 957522e..f0b51d0 100644
--- a/clownfish/runtime/core/Clownfish/Util/Atomic.c
+++ b/clownfish/runtime/core/Clownfish/Util/Atomic.c
@@ -25,8 +25,13 @@
 chy_bool_t
 lucy_Atomic_wrapped_cas_ptr(void *volatile *target, void *old_value,
                             void *new_value) {
+#ifdef _WIN64
     return InterlockedCompareExchangePointer(target, new_value, old_value)
            == old_value;
+#else
+    return InterlockedCompareExchange((void **)target, new_value, old_value)
+           == old_value;
+#endif
 }
 
 /************************** Fall back to ptheads ***************************/

http://git-wip-us.apache.org/repos/asf/lucy/blob/ded3ae77/core/Clownfish/Util/Atomic.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/Util/Atomic.c b/core/Clownfish/Util/Atomic.c
index 957522e..f0b51d0 100644
--- a/core/Clownfish/Util/Atomic.c
+++ b/core/Clownfish/Util/Atomic.c
@@ -25,8 +25,13 @@
 chy_bool_t
 lucy_Atomic_wrapped_cas_ptr(void *volatile *target, void *old_value,
                             void *new_value) {
+#ifdef _WIN64
     return InterlockedCompareExchangePointer(target, new_value, old_value)
            == old_value;
+#else
+    return InterlockedCompareExchange((void **)target, new_value, old_value)
+           == old_value;
+#endif
 }
 
 /************************** Fall back to ptheads ***************************/

Reply via email to