mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
ruby_atomic.h: refine ATOMIC_PTR_CAS
* ruby_atomic.h (ATOMIC_PTR_CAS): define by generic CAS macro, not via size_t, to suppress a warning by mingw gcc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e833adaa69
commit
9767eb3001
2 changed files with 7 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Sun Jun 21 18:32:37 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* ruby_atomic.h (ATOMIC_PTR_CAS): define by generic CAS macro, not
|
||||||
|
via size_t, to suppress a warning by mingw gcc.
|
||||||
|
|
||||||
Sun Jun 21 05:31:41 2015 Shota Fukumori <her@sorah.jp>
|
Sun Jun 21 05:31:41 2015 Shota Fukumori <her@sorah.jp>
|
||||||
|
|
||||||
* ext/objspace/objspace_dump.c(dump_object): Return empty JSON object when
|
* ext/objspace/objspace_dump.c(dump_object): Return empty JSON object when
|
||||||
|
|
|
@ -18,6 +18,7 @@ typedef unsigned int rb_atomic_t;
|
||||||
# define ATOMIC_SIZE_SUB(var, val) __atomic_fetch_sub(&(var), (val), __ATOMIC_SEQ_CST)
|
# define ATOMIC_SIZE_SUB(var, val) __atomic_fetch_sub(&(var), (val), __ATOMIC_SEQ_CST)
|
||||||
|
|
||||||
# define ATOMIC_PTR_EXCHANGE(var, val) __atomic_exchange_n(&(var), (val), __ATOMIC_SEQ_CST)
|
# define ATOMIC_PTR_EXCHANGE(var, val) __atomic_exchange_n(&(var), (val), __ATOMIC_SEQ_CST)
|
||||||
|
# define ATOMIC_PTR_CAS(var, oldval, newval) ATOMIC_CAS(var, oldval, newval)
|
||||||
|
|
||||||
#elif defined HAVE_GCC_SYNC_BUILTINS
|
#elif defined HAVE_GCC_SYNC_BUILTINS
|
||||||
/* @shyouhei hack to support atomic operations in case of gcc. Gcc
|
/* @shyouhei hack to support atomic operations in case of gcc. Gcc
|
||||||
|
@ -36,6 +37,7 @@ typedef unsigned int rb_atomic_t; /* Anything OK */
|
||||||
# define ATOMIC_SIZE_SUB(var, val) __sync_fetch_and_sub(&(var), (val))
|
# define ATOMIC_SIZE_SUB(var, val) __sync_fetch_and_sub(&(var), (val))
|
||||||
|
|
||||||
# define ATOMIC_PTR_EXCHANGE(var, val) __sync_lock_test_and_set(&(var), (val))
|
# define ATOMIC_PTR_EXCHANGE(var, val) __sync_lock_test_and_set(&(var), (val))
|
||||||
|
# define ATOMIC_PTR_CAS(var, oldval, newval) ATOMIC_CAS(var, oldval, newval)
|
||||||
|
|
||||||
#elif defined _WIN32
|
#elif defined _WIN32
|
||||||
#if defined _MSC_VER && _MSC_VER > 1200
|
#if defined _MSC_VER && _MSC_VER > 1200
|
||||||
|
|
Loading…
Reference in a new issue