mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Use atomic load to read interrupt mask
This commit is contained in:
parent
cd15cc250f
commit
05e0e7223a
Notes:
git
2025-05-20 17:00:21 +00:00
4 changed files with 25 additions and 9 deletions
|
@ -1,3 +1,6 @@
|
|||
#ifndef INTERNAL_ATOMIC_H
|
||||
#define INTERNAL_ATOMIC_H
|
||||
|
||||
#include "ruby/atomic.h"
|
||||
|
||||
/* shim macros only */
|
||||
|
@ -21,3 +24,16 @@
|
|||
#define ATOMIC_SUB(var, val) RUBY_ATOMIC_SUB(var, val)
|
||||
#define ATOMIC_VALUE_CAS(var, oldval, val) RUBY_ATOMIC_VALUE_CAS(var, oldval, val)
|
||||
#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)
|
||||
{
|
||||
#if defined(HAVE_GCC_ATOMIC_BUILTINS)
|
||||
return __atomic_load_n(ptr, __ATOMIC_RELAXED);
|
||||
#else
|
||||
return *ptr;
|
||||
#endif
|
||||
}
|
||||
#define ATOMIC_LOAD_RELAXED(var) rbimpl_atomic_load_relaxed(&(var))
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue