summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2025-06-05 17:32:24 +0900
committerNobuyoshi Nakada <[email protected]>2025-06-05 17:32:24 +0900
commit9f112afcde513489b9b44b77bd2bd66843388dfb (patch)
tree1f1849ea65000bf23ed0dddf2c2fea58f29fe337
parent9e84a278a3bfee575fee71f64e47f0114a03c7e1 (diff)
Allow volatile pointer relaxed atomic operations
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13521
-rw-r--r--ruby_atomic.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/ruby_atomic.h b/ruby_atomic.h
index 216e292571..f5f32191af 100644
--- a/ruby_atomic.h
+++ b/ruby_atomic.h
@@ -26,7 +26,7 @@
#define ATOMIC_VALUE_EXCHANGE(var, val) RUBY_ATOMIC_VALUE_EXCHANGE(var, val)
static inline rb_atomic_t
-rbimpl_atomic_load_relaxed(rb_atomic_t *ptr)
+rbimpl_atomic_load_relaxed(volatile rb_atomic_t *ptr)
{
#if defined(HAVE_GCC_ATOMIC_BUILTINS)
return __atomic_load_n(ptr, __ATOMIC_RELAXED);
@@ -37,7 +37,7 @@ rbimpl_atomic_load_relaxed(rb_atomic_t *ptr)
#define ATOMIC_LOAD_RELAXED(var) rbimpl_atomic_load_relaxed(&(var))
static inline uint64_t
-rbimpl_atomic_u64_load_relaxed(const uint64_t *value)
+rbimpl_atomic_u64_load_relaxed(const volatile uint64_t *value)
{
#if defined(HAVE_GCC_ATOMIC_BUILTINS_64)
return __atomic_load_n(value, __ATOMIC_RELAXED);
@@ -54,7 +54,7 @@ rbimpl_atomic_u64_load_relaxed(const uint64_t *value)
#define ATOMIC_U64_LOAD_RELAXED(var) rbimpl_atomic_u64_load_relaxed(&(var))
static inline void
-rbimpl_atomic_u64_set_relaxed(uint64_t *address, uint64_t value)
+rbimpl_atomic_u64_set_relaxed(volatile uint64_t *address, uint64_t value)
{
#if defined(HAVE_GCC_ATOMIC_BUILTINS_64)
__atomic_store_n(address, value, __ATOMIC_RELAXED);