зеркало из https://github.com/github/ruby.git
ruby_atomic.h: ATOMIC_SIZE_CAS
* ruby_atomic.h (ATOMIC_SIZE_CAS): new macro, compare and swap size_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
52d8f9f3ef
Коммит
1058f20672
|
@ -1,3 +1,7 @@
|
|||
Tue Oct 29 15:46:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ruby_atomic.h (ATOMIC_SIZE_CAS): new macro, compare and swap size_t.
|
||||
|
||||
Tue Oct 29 12:08:05 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/readline/readline.c (readline_getc): Consider
|
||||
|
|
|
@ -65,6 +65,7 @@ rb_w32_atomic_cas(volatile rb_atomic_t *var, rb_atomic_t oldval, rb_atomic_t new
|
|||
# define ATOMIC_SIZE_INC(var) InterlockedIncrement64(&(var))
|
||||
# define ATOMIC_SIZE_DEC(var) InterlockedDecrement64(&(var))
|
||||
# define ATOMIC_SIZE_EXCHANGE(var, val) InterlockedExchange64(&(var), (val))
|
||||
# define ATOMIC_SIZE_CAS(var, oldval, val) InterlockedCompareExchange64(&(var), (oldval), (val))
|
||||
# else
|
||||
# define ATOMIC_SIZE_ADD(var, val) InterlockedExchangeAdd((LONG *)&(var), (val))
|
||||
# define ATOMIC_SIZE_SUB(var, val) InterlockedExchangeAdd((LONG *)&(var), -(LONG)(val))
|
||||
|
@ -90,6 +91,7 @@ typedef unsigned int rb_atomic_t;
|
|||
# define ATOMIC_SIZE_INC(var) atomic_inc_ulong(&(var))
|
||||
# define ATOMIC_SIZE_DEC(var) atomic_dec_ulong(&(var))
|
||||
# define ATOMIC_SIZE_EXCHANGE(var, val) atomic_swap_ulong(&(var), (val))
|
||||
# define ATOMIC_SIZE_CAS(var, oldval, val) atomic_cas_ulong(&(var), (val))
|
||||
# else
|
||||
# define ATOMIC_SIZE_ADD(var, val) atomic_add_int(&(var), (val))
|
||||
# define ATOMIC_SIZE_SUB(var, val) atomic_add_int(&(var), -(val))
|
||||
|
@ -127,4 +129,8 @@ atomic_size_exchange(size_t *ptr, size_t val)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef ATOMIC_SIZE_CAS
|
||||
# define ATOMIC_SIZE_CAS(var, oldval, val) ATOMIC_CAS(var, oldval, val)
|
||||
#endif
|
||||
|
||||
#endif /* RUBY_ATOMIC_H */
|
||||
|
|
Загрузка…
Ссылка в новой задаче