Ruby  2.5.0dev(2017-10-22revision60238)
Macros | Typedefs | Functions
ruby_atomic.h File Reference

Go to the source code of this file.

Macros

#define NEED_RUBY_ATOMIC_OPS
 
#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))
 
#define ATOMIC_SIZE_INC(var)   ATOMIC_INC(var)
 
#define ATOMIC_SIZE_DEC(var)   ATOMIC_DEC(var)
 
#define ATOMIC_SIZE_CAS(var, oldval, val)   ATOMIC_CAS(var, oldval, val)
 
#define ATOMIC_PTR_EXCHANGE(var, val)   (void *)ATOMIC_SIZE_EXCHANGE(*(size_t *)&(var), (size_t)(val))
 
#define ATOMIC_PTR_CAS(var, oldval, val)   (void *)ATOMIC_SIZE_CAS(*(size_t *)&(var), (size_t)(oldval), (size_t)(val))
 
#define ATOMIC_VALUE_EXCHANGE(var, val)   ATOMIC_SIZE_EXCHANGE(*(size_t *)&(var), (size_t)(val))
 
#define ATOMIC_VALUE_CAS(var, oldval, val)   ATOMIC_SIZE_CAS(*(size_t *)&(var), (size_t)(oldval), (size_t)(val))
 

Typedefs

typedef int rb_atomic_t
 

Functions

rb_atomic_t ruby_atomic_exchange (rb_atomic_t *ptr, rb_atomic_t val)
 
rb_atomic_t ruby_atomic_compare_and_swap (rb_atomic_t *ptr, rb_atomic_t cmp, rb_atomic_t newval)
 

Macro Definition Documentation

◆ ATOMIC_CAS

#define ATOMIC_CAS (   var,
  oldval,
  newval 
)    ruby_atomic_compare_and_swap(&(var), (oldval), (newval))

Definition at line 132 of file ruby_atomic.h.

Referenced by rb_postponed_job_flush().

◆ ATOMIC_DEC

#define ATOMIC_DEC (   var)    ((var)--)

Definition at line 129 of file ruby_atomic.h.

◆ ATOMIC_EXCHANGE

#define ATOMIC_EXCHANGE (   var,
  val 
)    ruby_atomic_exchange(&(var), (val))

Definition at line 131 of file ruby_atomic.h.

◆ ATOMIC_INC

#define ATOMIC_INC (   var)    ((var)++)

Definition at line 128 of file ruby_atomic.h.

◆ ATOMIC_OR

#define ATOMIC_OR (   var,
  val 
)    ((var) |= (val))

Definition at line 130 of file ruby_atomic.h.

◆ ATOMIC_PTR_CAS

#define ATOMIC_PTR_CAS (   var,
  oldval,
  val 
)    (void *)ATOMIC_SIZE_CAS(*(size_t *)&(var), (size_t)(oldval), (size_t)(val))

Definition at line 191 of file ruby_atomic.h.

◆ ATOMIC_PTR_EXCHANGE

#define ATOMIC_PTR_EXCHANGE (   var,
  val 
)    (void *)ATOMIC_SIZE_EXCHANGE(*(size_t *)&(var), (size_t)(val))

Definition at line 177 of file ruby_atomic.h.

Referenced by rb_free_tmp_buffer().

◆ ATOMIC_SET

#define ATOMIC_SET (   var,
  val 
)    (void)((var) = (val))

Definition at line 127 of file ruby_atomic.h.

◆ ATOMIC_SIZE_ADD

#define ATOMIC_SIZE_ADD (   var,
  val 
)    (void)((var) += (val))

Definition at line 134 of file ruby_atomic.h.

◆ ATOMIC_SIZE_CAS

#define ATOMIC_SIZE_CAS (   var,
  oldval,
  val 
)    ATOMIC_CAS(var, oldval, val)

Definition at line 156 of file ruby_atomic.h.

◆ ATOMIC_SIZE_DEC

#define ATOMIC_SIZE_DEC (   var)    ATOMIC_DEC(var)

Definition at line 150 of file ruby_atomic.h.

◆ ATOMIC_SIZE_EXCHANGE

#define ATOMIC_SIZE_EXCHANGE (   var,
  val 
)    ruby_atomic_size_exchange(&(var), (val))

Definition at line 136 of file ruby_atomic.h.

◆ ATOMIC_SIZE_INC

#define ATOMIC_SIZE_INC (   var)    ATOMIC_INC(var)

Definition at line 147 of file ruby_atomic.h.

◆ ATOMIC_SIZE_SUB

#define ATOMIC_SIZE_SUB (   var,
  val 
)    (void)((var) -= (val))

Definition at line 135 of file ruby_atomic.h.

◆ ATOMIC_VALUE_CAS

#define ATOMIC_VALUE_CAS (   var,
  oldval,
  val 
)    ATOMIC_SIZE_CAS(*(size_t *)&(var), (size_t)(oldval), (size_t)(val))

Definition at line 220 of file ruby_atomic.h.

◆ ATOMIC_VALUE_EXCHANGE

#define ATOMIC_VALUE_EXCHANGE (   var,
  val 
)    ATOMIC_SIZE_EXCHANGE(*(size_t *)&(var), (size_t)(val))

Definition at line 206 of file ruby_atomic.h.

Referenced by rb_free_tmp_buffer().

◆ NEED_RUBY_ATOMIC_OPS

#define NEED_RUBY_ATOMIC_OPS

Definition at line 121 of file ruby_atomic.h.

Typedef Documentation

◆ rb_atomic_t

typedef int rb_atomic_t

Definition at line 120 of file ruby_atomic.h.

Function Documentation

◆ ruby_atomic_compare_and_swap()

rb_atomic_t ruby_atomic_compare_and_swap ( rb_atomic_t ptr,
rb_atomic_t  cmp,
rb_atomic_t  newval 
)

Definition at line 61 of file signal.c.

◆ ruby_atomic_exchange()

rb_atomic_t ruby_atomic_exchange ( rb_atomic_t ptr,
rb_atomic_t  val 
)

Definition at line 53 of file signal.c.

References val.