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

ruby-changes:29708

From: nobu <ko1@a...>
Date: Thu, 4 Jul 2013 00:13:17 +0900 (JST)
Subject: [ruby-changes:29708] nobu:r41760 (trunk): ruby_atomic.h: ATOMIC_CAS on VC6

nobu	2013-07-04 00:13:06 +0900 (Thu, 04 Jul 2013)

  New Revision: 41760

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

  Log:
    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.

  Modified files:
    trunk/ChangeLog
    trunk/ruby_atomic.h

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41759)
+++ ChangeLog	(revision 41760)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jul  4 00:13:01 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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@r...>
 
 	* ruby_atomic.h (ATOMIC_CAS): suppress C4022 and C4047 warnings in
Index: ruby_atomic.h
===================================================================
--- ruby_atomic.h	(revision 41759)
+++ ruby_atomic.h	(revision 41760)
@@ -54,10 +54,10 @@ rb_w32_atomic_or(volatile rb_atomic_t *v https://github.com/ruby/ruby/blob/trunk/ruby_atomic.h#L54
 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))

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

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