Ruby: include/ruby/atomic.h File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Macros
atomic.h File Reference

Go to the source code of this file.

## Macros
#define | RUBY_ATOMIC_SET(var, val) (void)RUBY_ATOMIC_EXCHANGE(var, val)
#define | RUBY_ATOMIC_ADD(var, val) (void)RUBY_ATOMIC_FETCH_ADD(var, val)
#define | RUBY_ATOMIC_SUB(var, val) (void)RUBY_ATOMIC_FETCH_SUB(var, val)
#define | RUBY_ATOMIC_INC(var) RUBY_ATOMIC_ADD(var, 1)
#define | RUBY_ATOMIC_DEC(var) RUBY_ATOMIC_SUB(var, 1)
#define | RUBY_ATOMIC_SIZE_INC(var) RUBY_ATOMIC_INC(var)
#define | RUBY_ATOMIC_SIZE_DEC(var) RUBY_ATOMIC_DEC(var)
#define | RUBY_ATOMIC_SIZE_EXCHANGE(var, val) RUBY_ATOMIC_EXCHANGE(var, val)
#define | RUBY_ATOMIC_SIZE_CAS(var, oldval, val) RUBY_ATOMIC_CAS(var, oldval, val)
#define | RUBY_ATOMIC_SIZE_ADD(var, val) RUBY_ATOMIC_ADD(var, val)
#define | RUBY_ATOMIC_SIZE_SUB(var, val) RUBY_ATOMIC_SUB(var, val)
#define | RUBY_ATOMIC_PTR_EXCHANGE(var, val) (void *)RUBY_ATOMIC_SIZE_EXCHANGE(*(size_t *)&(var), (size_t)(val))
#define | RUBY_ATOMIC_PTR_CAS(var, oldval, val) (void *)RUBY_ATOMIC_SIZE_CAS(*(size_t *)&(var), (size_t)(oldval), (size_t)(val))
#define | RUBY_ATOMIC_VALUE_EXCHANGE(var, val) RUBY_ATOMIC_SIZE_EXCHANGE(*(size_t *)&(var), (size_t)(val))
#define | RUBY_ATOMIC_VALUE_CAS(var, oldval, val) RUBY_ATOMIC_SIZE_CAS(*(size_t *)&(var), (size_t)(oldval), (size_t)(val))

## Macro Definition Documentation

## ◆ RUBY_ATOMIC_ADD

#define RUBY_ATOMIC_ADD | ( |  | var,
|  |  | val
| ) |  | (void)RUBY_ATOMIC_FETCH_ADD(var, val)

Definition at line 147 of file atomic.h.

## ◆ RUBY_ATOMIC_DEC

#define RUBY_ATOMIC_DEC | ( |  | var | ) | RUBY_ATOMIC_SUB(var, 1)

Definition at line 159 of file atomic.h.

## ◆ RUBY_ATOMIC_INC

#define RUBY_ATOMIC_INC | ( |  | var | ) | RUBY_ATOMIC_ADD(var, 1)

Definition at line 155 of file atomic.h.

## ◆ RUBY_ATOMIC_PTR_CAS

#define RUBY_ATOMIC_PTR_CAS | ( |  | var,
|  |  | oldval,
|  |  | val
| ) |  | (void *)RUBY_ATOMIC_SIZE_CAS(*(size_t *)&(var), (size_t)(oldval), (size_t)(val))

Definition at line 214 of file atomic.h.

## ◆ RUBY_ATOMIC_PTR_EXCHANGE

#define RUBY_ATOMIC_PTR_EXCHANGE | ( |  | var,
|  |  | val
| ) |  | (void *)RUBY_ATOMIC_SIZE_EXCHANGE(*(size_t *)&(var), (size_t)(val))

Definition at line 206 of file atomic.h.

## ◆ RUBY_ATOMIC_SET

#define RUBY_ATOMIC_SET | ( |  | var,
|  |  | val
| ) |  | (void)RUBY_ATOMIC_EXCHANGE(var, val)

Definition at line 143 of file atomic.h.

## ◆ RUBY_ATOMIC_SIZE_ADD

#define RUBY_ATOMIC_SIZE_ADD | ( |  | var,
|  |  | val
| ) |  | RUBY_ATOMIC_ADD(var, val)

Definition at line 179 of file atomic.h.

## ◆ RUBY_ATOMIC_SIZE_CAS

#define RUBY_ATOMIC_SIZE_CAS | ( |  | var,
|  |  | oldval,
|  |  | val
| ) |  | RUBY_ATOMIC_CAS(var, oldval, val)

Definition at line 175 of file atomic.h.

## ◆ RUBY_ATOMIC_SIZE_DEC

#define RUBY_ATOMIC_SIZE_DEC | ( |  | var | ) | RUBY_ATOMIC_DEC(var)

Definition at line 167 of file atomic.h.

## ◆ RUBY_ATOMIC_SIZE_EXCHANGE

#define RUBY_ATOMIC_SIZE_EXCHANGE | ( |  | var,
|  |  | val
| ) |  | RUBY_ATOMIC_EXCHANGE(var, val)

Definition at line 171 of file atomic.h.

## ◆ RUBY_ATOMIC_SIZE_INC

#define RUBY_ATOMIC_SIZE_INC | ( |  | var | ) | RUBY_ATOMIC_INC(var)

Definition at line 163 of file atomic.h.

## ◆ RUBY_ATOMIC_SIZE_SUB

#define RUBY_ATOMIC_SIZE_SUB | ( |  | var,
|  |  | val
| ) |  | RUBY_ATOMIC_SUB(var, val)

Definition at line 183 of file atomic.h.

## ◆ RUBY_ATOMIC_SUB

#define RUBY_ATOMIC_SUB | ( |  | var,
|  |  | val
| ) |  | (void)RUBY_ATOMIC_FETCH_SUB(var, val)

Definition at line 151 of file atomic.h.

## ◆ RUBY_ATOMIC_VALUE_CAS

#define RUBY_ATOMIC_VALUE_CAS | ( |  | var,
|  |  | oldval,
|  |  | val
| ) |  | RUBY_ATOMIC_SIZE_CAS(*(size_t *)&(var), (size_t)(oldval), (size_t)(val))

Definition at line 230 of file atomic.h.

## ◆ RUBY_ATOMIC_VALUE_EXCHANGE

#define RUBY_ATOMIC_VALUE_EXCHANGE | ( |  | var,
|  |  | val
| ) |  | RUBY_ATOMIC_SIZE_EXCHANGE(*(size_t *)&(var), (size_t)(val))

Definition at line 222 of file atomic.h.