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.
This commit is contained in:
parent
e92f3e1216
commit
20773a1090
|
@ -121,30 +121,7 @@ typedef unsigned int rb_atomic_t;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
typedef int rb_atomic_t;
|
# error No atomic operation found
|
||||||
#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;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ATOMIC_SIZE_INC
|
#ifndef ATOMIC_SIZE_INC
|
||||||
|
|
Loading…
Reference in New Issue