1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2013-07-03 15:13:06 +00:00
parent b12ffcb15d
commit 15d4450907
2 changed files with 9 additions and 2 deletions

View file

@ -1,3 +1,10 @@
Thu Jul 4 00:13:01 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ruby_atomic.h (rb_w32_atomic_cas): call InterlockedCompareExchange
directly.
* ruby_atomic.h (ATOMIC_CAS): fix missing function call.
Wed Jul 3 23:47:35 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> Wed Jul 3 23:47:35 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ruby_atomic.h (ATOMIC_CAS): suppress C4022 and C4047 warnings in * ruby_atomic.h (ATOMIC_CAS): suppress C4022 and C4047 warnings in

View file

@ -54,10 +54,10 @@ rb_w32_atomic_or(volatile rb_atomic_t *var, rb_atomic_t val)
static inline rb_atomic_t static inline rb_atomic_t
rb_w32_atomic_cas(volatile rb_atomic_t *var, rb_atomic_t oldval, rb_atomic_t newval) 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 # 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 # endif
# ifdef _M_AMD64 # ifdef _M_AMD64
# define ATOMIC_SIZE_ADD(var, val) InterlockedExchangeAdd64(&(var), (val)) # define ATOMIC_SIZE_ADD(var, val) InterlockedExchangeAdd64(&(var), (val))