PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
generic.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define pg_read_barrier_impl   pg_memory_barrier_impl
 
#define pg_write_barrier_impl   pg_memory_barrier_impl
 
#define pg_spin_delay_impl()   ((void)0)
 
#define PG_HAVE_ATOMIC_READ_U32
 
#define PG_HAVE_ATOMIC_WRITE_U32
 
#define PG_HAVE_ATOMIC_UNLOCKED_WRITE_U32
 
#define PG_HAVE_ATOMIC_INIT_U32
 
#define PG_HAVE_ATOMIC_WRITE_U64
 
#define PG_HAVE_ATOMIC_READ_U64
 
#define PG_HAVE_ATOMIC_INIT_U64
 

Functions

static uint32 pg_atomic_read_u32_impl (volatile pg_atomic_uint32 *ptr)
 
static void pg_atomic_write_u32_impl (volatile pg_atomic_uint32 *ptr, uint32 val)
 
static void pg_atomic_unlocked_write_u32_impl (volatile pg_atomic_uint32 *ptr, uint32 val)
 
static void pg_atomic_init_u32_impl (volatile pg_atomic_uint32 *ptr, uint32 val_)
 
static void pg_atomic_write_u64_impl (volatile pg_atomic_uint64 *ptr, uint64 val)
 
static uint64 pg_atomic_read_u64_impl (volatile pg_atomic_uint64 *ptr)
 
static void pg_atomic_init_u64_impl (volatile pg_atomic_uint64 *ptr, uint64 val_)
 

Macro Definition Documentation

#define PG_HAVE_ATOMIC_INIT_U32

Definition at line 159 of file generic.h.

#define PG_HAVE_ATOMIC_INIT_U64

Definition at line 346 of file generic.h.

#define PG_HAVE_ATOMIC_READ_U32

Definition at line 44 of file generic.h.

#define PG_HAVE_ATOMIC_READ_U64

Definition at line 308 of file generic.h.

#define PG_HAVE_ATOMIC_UNLOCKED_WRITE_U32

Definition at line 62 of file generic.h.

#define PG_HAVE_ATOMIC_WRITE_U32

Definition at line 53 of file generic.h.

#define PG_HAVE_ATOMIC_WRITE_U64

Definition at line 275 of file generic.h.

#define pg_read_barrier_impl   pg_memory_barrier_impl

Definition at line 25 of file generic.h.

#define pg_spin_delay_impl ( )    ((void)0)

Definition at line 33 of file generic.h.

#define pg_write_barrier_impl   pg_memory_barrier_impl

Definition at line 28 of file generic.h.

Function Documentation

static void pg_atomic_init_u32_impl ( volatile pg_atomic_uint32 ptr,
uint32  val_ 
)
inlinestatic

Definition at line 161 of file generic.h.

References pg_atomic_write_u32_impl().

162 {
163  pg_atomic_write_u32_impl(ptr, val_);
164 }
static void pg_atomic_write_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 val)
Definition: generic.h:55
static void pg_atomic_init_u64_impl ( volatile pg_atomic_uint64 ptr,
uint64  val_ 
)
inlinestatic

Definition at line 348 of file generic.h.

References pg_atomic_write_u64_impl().

349 {
350  pg_atomic_write_u64_impl(ptr, val_);
351 }
static void pg_atomic_write_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 val)
Definition: generic.h:295
static uint32 pg_atomic_read_u32_impl ( volatile pg_atomic_uint32 ptr)
inlinestatic

Definition at line 46 of file generic.h.

References pg_atomic_uint32::value.

Referenced by pg_atomic_read_u32().

47 {
48  return *(&ptr->value);
49 }
static uint64 pg_atomic_read_u64_impl ( volatile pg_atomic_uint64 ptr)
inlinestatic

Definition at line 328 of file generic.h.

References pg_atomic_compare_exchange_u64_impl().

Referenced by pg_atomic_read_u64().

329 {
330  uint64 old = 0;
331 
332  /*
333  * 64 bit reads aren't safe on all platforms. In the generic
334  * implementation implement them as a compare/exchange with 0. That'll
335  * fail or succeed, but always return the old value. Possible might store
336  * a 0, but only if the prev. value also was a 0 - i.e. harmless.
337  */
339 
340  return old;
341 }
bool pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 *expected, uint64 newval)
Definition: atomics.c:183
static void pg_atomic_unlocked_write_u32_impl ( volatile pg_atomic_uint32 ptr,
uint32  val 
)
inlinestatic

Definition at line 64 of file generic.h.

References val, and pg_atomic_uint32::value.

Referenced by pg_atomic_unlocked_write_u32().

65 {
66  ptr->value = val;
67 }
long val
Definition: informix.c:689
static void pg_atomic_write_u32_impl ( volatile pg_atomic_uint32 ptr,
uint32  val 
)
inlinestatic

Definition at line 55 of file generic.h.

References val, and pg_atomic_uint32::value.

Referenced by pg_atomic_init_u32_impl().

56 {
57  ptr->value = val;
58 }
long val
Definition: informix.c:689
static void pg_atomic_write_u64_impl ( volatile pg_atomic_uint64 ptr,
uint64  val 
)
inlinestatic

Definition at line 295 of file generic.h.

Referenced by pg_atomic_init_u64_impl(), and pg_atomic_write_u64().

296 {
297  /*
298  * 64 bit writes aren't safe on all platforms. In the generic
299  * implementation implement them as an atomic exchange.
300  */
301  pg_atomic_exchange_u64_impl(ptr, val);
302 }
long val
Definition: informix.c:689