summaryrefslogtreecommitdiff
path: root/include/ruby
diff options
context:
space:
mode:
authorJohn Hawthorn <[email protected]>2025-03-28 22:23:48 -0700
committerJohn Hawthorn <[email protected]>2025-04-18 13:03:54 +0900
commitb28363a8381fd4e93d1254e71486e0185a84c9c5 ()
treed3fe53bd2141fdd58730a8dc3f195f5b530337f7 /include/ruby
parent89199a47db25a89cbce05f1be6685e96ded32db5 (diff)
Work on ATOMIC_VALUE_SET
Notes: Merged: https://.com/ruby/ruby/pull/12921
-rw-r--r--include/ruby/atomic.h43
1 files changed, 43 insertions, 0 deletions
@@ -316,6 +316,19 @@ typedef unsigned int rb_atomic_t;
RBIMPL_CAST(rbimpl_atomic_ptr_cas((void **)&(var), (void *)(oldval), (void *)(newval)))
/**
* Identical to #RUBY_ATOMIC_EXCHANGE, except it expects its arguments are
* ::VALUE. There are cases where ::rb_atomic_t is 32bit while ::VALUE is
* 64bit. This should be used for pointer related operations to support such
@@ -733,6 +746,23 @@ rbimpl_atomic_size_exchange(volatile size_t *ptr, size_t val)
RBIMPL_ATTR_ARTIFICIAL()
RBIMPL_ATTR_NOALIAS()
RBIMPL_ATTR_NONNULL((1))
static inline void *
rbimpl_atomic_ptr_exchange(void *volatile *ptr, const void *val)
{
@@ -775,6 +805,19 @@ rbimpl_atomic_value_exchange(volatile VALUE *ptr, VALUE val)
RBIMPL_ATTR_ARTIFICIAL()
RBIMPL_ATTR_NOALIAS()
RBIMPL_ATTR_NONNULL((1))
static inline rb_atomic_t
rbimpl_atomic_load(volatile rb_atomic_t *ptr)
{