Skip to content

Commit

Permalink
* atomic.h (ATOMIC_*): use atomic_ops(3C) when SunStudio on Solaris.
Browse files Browse the repository at this point in the history
  [ruby-dev:44596] [Bug ruby#5439]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
ngoto committed Oct 13, 2011
1 parent 123645a commit 5558de4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -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.
Expand Down
10 changes: 10 additions & 0 deletions atomic.h
Expand Up @@ -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);
Expand Down

0 comments on commit 5558de4

Please sign in to comment.