summaryrefslogtreecommitdiff
path: root/ruby_atomic.h
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-03 15:13:06 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-03 15:13:06 (GMT)
commit15d4450907126ccc658e8f4e323257e81508af32 (patch)
treecf6dfd4de71a352a554f50d650d3f0e4a9a30bc6 /ruby_atomic.h
parentb12ffcb15d57644423fbbb48b31f09e65aa0a00f (diff)
ruby_atomic.h: ATOMIC_CAS on VC6
* ruby_atomic.h (rb_w32_atomic_cas): call InterlockedCompareExchange directly. * ruby_atomic.h (ATOMIC_CAS): fix missing function call. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby_atomic.h')
-rw-r--r--ruby_atomic.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/ruby_atomic.h b/ruby_atomic.h
index 53273a4..9bf5e03 100644
--- a/ruby_atomic.h
+++ b/ruby_atomic.h
@@ -54,10 +54,10 @@ rb_w32_atomic_or(volatile rb_atomic_t *var, rb_atomic_t val)
static inline rb_atomic_t
rb_w32_atomic_cas(volatile rb_atomic_t *var, rb_atomic_t oldval, rb_atomic_t newval)
{
- return (rb_atomic_t)ATOMIC_CAS(*(PVOID *)var, (PVOID)oldval, (PVOID)(newval));
+ return (rb_atomic_t)InterlockedCompareExchange((PVOID *)var, (PVOID)newval, (PVOID)oldval);
}
# undef ATOMIC_CAS
-# define ATOMIC_CAS(var, oldval, newval) (&(var), (newval), (oldval))
+# define ATOMIC_CAS(var, oldval, newval) rb_w32_atomic_cas(&(var), (oldval), (newval))
# endif
# ifdef _M_AMD64
# define ATOMIC_SIZE_ADD(var, val) InterlockedExchangeAdd64(&(var), (val))