summaryrefslogtreecommitdiff
path: root/ruby_atomic.h
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-30 11:04:17 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-30 11:04:17 +0000
commit858a5ba2ef16dde41085ab3e622f155fcf9b5be8 (patch)
treec63ccd2337cad1ceed312913b8b72b213b733b8a /ruby_atomic.h
parent2e574a5315e611ae2f5375bffb3827c64e1a0f17 (diff)
merge revision(s) 43994,44000: [Backport #9205]
* gc.c (finalize_deferred): flush all deferred finalizers while other finalizers can get ready to run newly by lazy sweep. [ruby-core:58833] [Bug #9205] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@44764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby_atomic.h')
-rw-r--r--ruby_atomic.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/ruby_atomic.h b/ruby_atomic.h
index 920c304116..81990620ef 100644
--- a/ruby_atomic.h
+++ b/ruby_atomic.h
@@ -19,6 +19,7 @@ typedef unsigned int rb_atomic_t; /* Anything OK */
# define ATOMIC_SIZE_INC(var) __sync_fetch_and_add(&(var), 1)
# define ATOMIC_SIZE_DEC(var) __sync_fetch_and_sub(&(var), 1)
# define ATOMIC_SIZE_EXCHANGE(var, val) __sync_lock_test_and_set(&(var), (val))
+# define ATOMIC_PTR_EXCHANGE(var, val) __atomic_exchange_n(&(var), (val), __ATOMIC_SEQ_CST)
#elif defined _WIN32
#if defined _MSC_VER && _MSC_VER > 1200
@@ -112,4 +113,10 @@ atomic_size_exchange(size_t *ptr, size_t val)
}
#endif
+#ifndef ATOMIC_PTR_EXCHANGE
+# if SIZEOF_VOIDP == SIZEOF_SIZE_T
+# define ATOMIC_PTR_EXCHANGE(var, val) (void *)ATOMIC_SIZE_EXCHANGE(*(size_t *)&(var), (size_t)(val))
+# endif
+#endif
+
#endif /* RUBY_ATOMIC_H */