ruby-changes:21414
From: ngoto <ko1@a...>
Date: Thu, 13 Oct 2011 19:40:07 +0900 (JST)
Subject: [ruby-changes:21414] ngoto:r33463 (trunk): * atomic.h (ATOMIC_*): use atomic_ops(3C) when SunStudio on Solaris.
ngoto 2011-10-13 19:39:58 +0900 (Thu, 13 Oct 2011) New Revision: 33463 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33463 Log: * atomic.h (ATOMIC_*): use atomic_ops(3C) when SunStudio on Solaris. [ruby-dev:44596] [Bug #5439] Modified files: trunk/ChangeLog trunk/atomic.h Index: ChangeLog =================================================================== --- ChangeLog (revision 33462) +++ ChangeLog (revision 33463) @@ -1,3 +1,8 @@ +Thu Oct 13 19:29:40 2011 Naohisa Goto <ngotogenome@g...> + + * atomic.h (ATOMIC_*): use atomic_ops(3C) when SunStudio on Solaris. + [ruby-dev:44596] [Bug #5439] + Thu Oct 13 18:13:04 2011 KOSAKI Motohiro <kosaki.motohiro@g...> * atomic.h(ATOMIC_SET): add cast to void to prevent misuse. Index: atomic.h =================================================================== --- atomic.h (revision 33462) +++ atomic.h (revision 33463) @@ -42,6 +42,16 @@ # define ATOMIC_OR(var, val) __sync_or_and_fetch(&(var), (val)) # define ATOMIC_EXCHANGE(var, val) __sync_lock_test_and_set(&(var), (val)) +#elif defined(__SUNPRO_C) +#include <atomic.h> +typedef unsigned int rb_atomic_t; + +# define ATOMIC_SET(var, val) (void)atomic_swap_uint(&(var), (val)) +# define ATOMIC_INC(var) atomic_inc_uint(&(var)) +# define ATOMIC_DEC(var) atomic_dec_uint(&(var)) +# define ATOMIC_OR(var, val) atomic_or_uint(&(var), (val)) +# define ATOMIC_EXCHANGE(var, val) atomic_swap_uint(&(var), (val)) + #else typedef int rb_atomic_t; extern rb_atomic_t ruby_atomic_exchange(rb_atomic_t *ptr, rb_atomic_t val); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/