diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ruby_atomic.h | 2 |
2 files changed, 7 insertions, 1 deletions
@@ -1,3 +1,9 @@ +Sat Dec 5 09:25:41 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * ruby_atomic.h (ATOMIC_SIZE_CAS): fix the argument order of + InterlockedCompareExchange64. new value and then old value is + the last. + Sat Dec 5 09:23:34 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> * random.c (fill_random_seed): fix the size to be filled, not the diff --git a/ruby_atomic.h b/ruby_atomic.h index 57368a7448..c8c84ed449 100644 --- a/ruby_atomic.h +++ b/ruby_atomic.h @@ -81,7 +81,7 @@ rb_w32_atomic_cas(volatile rb_atomic_t *var, rb_atomic_t oldval, rb_atomic_t new # define ATOMIC_SIZE_INC(var) InterlockedIncrement64(&(var)) # define ATOMIC_SIZE_DEC(var) InterlockedDecrement64(&(var)) # define ATOMIC_SIZE_EXCHANGE(var, val) InterlockedExchange64(&(var), (val)) -# define ATOMIC_SIZE_CAS(var, oldval, val) InterlockedCompareExchange64(&(var), (oldval), (val)) +# define ATOMIC_SIZE_CAS(var, oldval, newval) InterlockedCompareExchange64(&(var), (newval), (oldval)) # else # define ATOMIC_SIZE_ADD(var, val) InterlockedExchangeAdd((LONG *)&(var), (val)) # define ATOMIC_SIZE_SUB(var, val) InterlockedExchangeAdd((LONG *)&(var), -(LONG)(val)) |