[前][次][番号順一覧][スレッド一覧]

ruby-changes:60837

From: Nobuyoshi <ko1@a...>
Date: Mon, 20 Apr 2020 12:37:46 +0900 (JST)
Subject: [ruby-changes:60837] 20773a1090 (master): Bail out if no atomic operation found

https://git.ruby-lang.org/ruby.git/commit/?id=20773a1090

From 20773a109029ba4464d7749d38a311f880a73293 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Mon, 20 Apr 2020 10:44:52 +0900
Subject: Bail out if no atomic operation found

As atomic operations are mandatory now, not-working phony fallback
definitions are not only useless but confusing and harmful.

diff --git a/ruby_atomic.h b/ruby_atomic.h
index d4d56da..d233867 100644
--- a/ruby_atomic.h
+++ b/ruby_atomic.h
@@ -121,30 +121,7 @@ typedef unsigned int rb_atomic_t; https://github.com/ruby/ruby/blob/trunk/ruby_atomic.h#L121
 # endif
 
 #else
-typedef int rb_atomic_t;
-#define NEED_RUBY_ATOMIC_OPS
-extern rb_atomic_t ruby_atomic_exchange(rb_atomic_t *ptr, rb_atomic_t val);
-extern rb_atomic_t ruby_atomic_compare_and_swap(rb_atomic_t *ptr,
-						rb_atomic_t cmp,
-						rb_atomic_t newval);
-
-# define ATOMIC_SET(var, val) (void)((var) = (val))
-# define ATOMIC_INC(var) ((var)++)
-# define ATOMIC_DEC(var) ((var)--)
-# define ATOMIC_OR(var, val) ((var) |= (val))
-# define ATOMIC_EXCHANGE(var, val) ruby_atomic_exchange(&(var), (val))
-# define ATOMIC_CAS(var, oldval, newval) ruby_atomic_compare_and_swap(&(var), (oldval), (newval))
-
-# define ATOMIC_SIZE_ADD(var, val) (void)((var) += (val))
-# define ATOMIC_SIZE_SUB(var, val) (void)((var) -= (val))
-# define ATOMIC_SIZE_EXCHANGE(var, val) ruby_atomic_size_exchange(&(var), (val))
-static inline size_t
-ruby_atomic_size_exchange(size_t *ptr, size_t val)
-{
-    size_t old = *ptr;
-    *ptr = val;
-    return old;
-}
+# error No atomic operation found
 #endif
 
 #ifndef ATOMIC_SIZE_INC
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]