[前][次][番号順一覧][スレッド一覧]

ruby-changes:40814

From: nobu <ko1@a...>
Date: Sat, 5 Dec 2015 09:57:01 +0900 (JST)
Subject: [ruby-changes:40814] nobu:r52893 (trunk): ruby_atomic.h: fix old value type of ATOMIC_CAS

nobu	2015-12-05 09:56:52 +0900 (Sat, 05 Dec 2015)

  New Revision: 52893

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52893

  Log:
    ruby_atomic.h: fix old value type of ATOMIC_CAS
    
    * ruby_atomic.h (ATOMIC_CAS): old value to be swapped should be
      same as the destination.  immediate value may need type
      promotion.

  Modified files:
    trunk/ChangeLog
    trunk/ruby_atomic.h
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52892)
+++ ChangeLog	(revision 52893)
@@ -1,4 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Sat Dec  5 09:25:41 2015  Nobuyoshi Nakada  <nobu@r...>
+Sat Dec  5 09:56:50 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* ruby_atomic.h (ATOMIC_CAS): old value to be swapped should be
+	  same as the destination.  immediate value may need type
+	  promotion.
 
 	* ruby_atomic.h (ATOMIC_SIZE_CAS): fix the argument order of
 	  InterlockedCompareExchange64.  new value and then old value is
Index: ruby_atomic.h
===================================================================
--- ruby_atomic.h	(revision 52892)
+++ ruby_atomic.h	(revision 52893)
@@ -10,7 +10,7 @@ typedef unsigned int rb_atomic_t; https://github.com/ruby/ruby/blob/trunk/ruby_atomic.h#L10
 # define ATOMIC_OR(var, val) __atomic_fetch_or(&(var), (val), __ATOMIC_SEQ_CST)
 # define ATOMIC_EXCHANGE(var, val) __atomic_exchange_n(&(var), (val), __ATOMIC_SEQ_CST)
 # define ATOMIC_CAS(var, oldval, newval) \
-({ __typeof__(oldval) oldvaldup = (oldval); /* oldval should not be modified */ \
+({ __typeof__(var) oldvaldup = (oldval); /* oldval should not be modified */ \
    __atomic_compare_exchange_n(&(var), &oldvaldup, (newval), 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); \
    oldvaldup; })
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]