1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
ngoto 2011-10-13 10:39:58 +00:00
parent 123645aab6
commit 5558de40b6
2 changed files with 15 additions and 0 deletions

View file

@ -1,3 +1,8 @@
Thu Oct 13 19:29:40 2011 Naohisa Goto <ngotogenome@gmail.com>
* 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@gmail.com>
* atomic.h(ATOMIC_SET): add cast to void to prevent misuse.

View file

@ -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);