diff options
| author | John Hawthorn <john@hawthorn.email> | 2025-11-24 21:07:08 -0800 |
|---|---|---|
| committer | John Hawthorn <john@hawthorn.email> | 2025-11-25 13:48:35 -0800 |
| commit | 4263f1d718df65bdf465552029a71b1ea9747067 (patch) | |
| tree | 398763362e1d14780576651ba30790078c14d046 /ruby_atomic.h | |
| parent | 0eb53053f00458b5b32bb66f63cb7c4c5f402ec8 (diff) | |
Store fiber serial as Ractor-local
Diffstat (limited to 'ruby_atomic.h')
| -rw-r--r-- | ruby_atomic.h | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/ruby_atomic.h b/ruby_atomic.h index b60c56cfd8..cbcfe682ce 100644 --- a/ruby_atomic.h +++ b/ruby_atomic.h @@ -70,27 +70,4 @@ rbimpl_atomic_u64_set_relaxed(volatile rbimpl_atomic_uint64_t *address, uint64_t } #define ATOMIC_U64_SET_RELAXED(var, val) rbimpl_atomic_u64_set_relaxed(&(var), val) -static inline uint64_t -rbimpl_atomic_u64_fetch_add(volatile rbimpl_atomic_uint64_t *ptr, uint64_t val) -{ -#if defined(HAVE_GCC_ATOMIC_BUILTINS_64) - return __atomic_fetch_add(ptr, val, __ATOMIC_SEQ_CST); -#elif defined(_WIN32) - return InterlockedExchangeAdd64((volatile LONG64 *)ptr, val); -#elif defined(__sun) && defined(HAVE_ATOMIC_H) && (defined(_LP64) || defined(_I32LPx)) - return atomic_add_64_nv(ptr, val) - val; -#elif defined(HAVE_STDATOMIC_H) - return atomic_fetch_add_explicit((_Atomic uint64_t *)ptr, val, memory_order_seq_cst); -#else - // Fallback using mutex for platforms without 64-bit atomics - static rb_nativethread_mutex_t lock = RB_NATIVETHREAD_LOCK_INIT; - rb_native_mutex_lock(&lock); - uint64_t old = *ptr; - *ptr = old + val; - rb_native_mutex_unlock(&lock); - return old; -#endif -} -#define ATOMIC_U64_FETCH_ADD(var, val) rbimpl_atomic_u64_fetch_add(&(var), val) - #endif |
