mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Implement rbimpl_atomic_value_load
This only adds the rbimpl_ version to include/ruby/atomic.h so that it is not a new public interface. We were already using RUBY_ATOMIC_VALUE_LOAD in a few locations. This will allow us to use other memory orders internally when desired.
This commit is contained in:
parent
77d29ef73c
commit
cb360b0b4b
2 changed files with 10 additions and 1 deletions
|
@ -1156,6 +1156,15 @@ rbimpl_atomic_ptr_load(void **ptr, int memory_order)
|
|||
#endif
|
||||
}
|
||||
|
||||
RBIMPL_ATTR_ARTIFICIAL()
|
||||
RBIMPL_ATTR_NOALIAS()
|
||||
RBIMPL_ATTR_NONNULL((1))
|
||||
static inline VALUE
|
||||
rbimpl_atomic_value_load(volatile VALUE *ptr, int memory_order)
|
||||
{
|
||||
return RBIMPL_CAST((VALUE)rbimpl_atomic_ptr_load((void **)ptr, memory_order));
|
||||
}
|
||||
|
||||
RBIMPL_ATTR_ARTIFICIAL()
|
||||
RBIMPL_ATTR_NOALIAS()
|
||||
RBIMPL_ATTR_NONNULL((1))
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "ruby/atomic.h"
|
||||
|
||||
#define RUBY_ATOMIC_VALUE_LOAD(x) (VALUE)(RUBY_ATOMIC_PTR_LOAD(x))
|
||||
#define RUBY_ATOMIC_VALUE_LOAD(x) rbimpl_atomic_value_load(&(x), RBIMPL_ATOMIC_SEQ_CST)
|
||||
|
||||
/* shim macros only */
|
||||
#define ATOMIC_ADD(var, val) RUBY_ATOMIC_ADD(var, val)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue