diff options
author | ngoto <ngoto@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-10-13 10:39:58 +0000 |
---|---|---|
committer | ngoto <ngoto@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-10-13 10:39:58 +0000 |
commit | 5558de40b6344f5bdba783b170a54df80f4b4e6d (patch) | |
tree | 4ca9ba18b914597a525309cf4a46110ebbf66257 | |
parent | 123645aab61c07fb3c64e3f2ea771cb74f53ff64 (diff) |
* atomic.h (ATOMIC_*): use atomic_ops(3C) when SunStudio on Solaris.
[ruby-dev:44596] [Bug #5439]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | atomic.h | 10 |
2 files changed, 15 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Thu Oct 13 19:29:40 2011 Naohisa Goto <[email protected]> + + * 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 <[email protected]> * atomic.h(ATOMIC_SET): add cast to void to prevent misuse. @@ -42,6 +42,16 @@ typedef unsigned int rb_atomic_t; /* Anything OK */ # 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); |