PostgreSQL Source Code  git master
generic.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


#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)


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



Definition at line 159 of file generic.h.



Definition at line 329 of file generic.h.



Definition at line 44 of file generic.h.



Definition at line 293 of file generic.h.



Definition at line 62 of file generic.h.



Definition at line 53 of file generic.h.



Definition at line 260 of file generic.h.

◆ pg_read_barrier_impl

#define pg_read_barrier_impl   pg_memory_barrier_impl

Definition at line 25 of file generic.h.

◆ pg_spin_delay_impl

#define pg_spin_delay_impl ( )    ((void)0)

Definition at line 33 of file generic.h.

◆ pg_write_barrier_impl

#define pg_write_barrier_impl   pg_memory_barrier_impl

Definition at line 28 of file generic.h.

Function Documentation

◆ pg_atomic_init_u32_impl()

static void pg_atomic_init_u32_impl ( volatile pg_atomic_uint32 ptr,
uint32  val_ 

Definition at line 161 of file generic.h.

References pg_atomic_compare_exchange_u32_impl(), pg_atomic_compare_exchange_u64_impl(), pg_atomic_fetch_add_u32_impl(), pg_atomic_write_u32_impl(), pg_atomic_uint32::value, and pg_atomic_uint64::value.

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

◆ pg_atomic_init_u64_impl()

static void pg_atomic_init_u64_impl ( volatile pg_atomic_uint64 ptr,
uint64  val_ 

Definition at line 331 of file generic.h.

References pg_atomic_compare_exchange_u64_impl(), pg_atomic_fetch_add_u64_impl(), pg_atomic_write_u64_impl(), and pg_atomic_uint64::value.

332 {
333  pg_atomic_write_u64_impl(ptr, val_);
334 }
static void pg_atomic_write_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 val)
Definition: generic.h:280

◆ pg_atomic_read_u32_impl()

static uint32 pg_atomic_read_u32_impl ( volatile pg_atomic_uint32 ptr)

Definition at line 46 of file generic.h.

References pg_atomic_uint32::value.

Referenced by pg_atomic_read_u32(), and pg_atomic_unlocked_write_u32_impl().

47 {
48  return ptr->value;
49 }

◆ pg_atomic_read_u64_impl()

static uint64 pg_atomic_read_u64_impl ( volatile pg_atomic_uint64 ptr)

Definition at line 311 of file generic.h.

References pg_atomic_compare_exchange_u64_impl().

Referenced by pg_atomic_read_u64().

312 {
313  uint64 old = 0;
315  /*
316  * 64-bit reads aren't atomic on all platforms. In the generic
317  * implementation implement them as a compare/exchange with 0. That'll
318  * fail or succeed, but always return the old value. Possibly might store
319  * a 0, but only if the previous value also was a 0 - i.e. harmless.
320  */
323  return old;
324 }
bool pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 *expected, uint64 newval)
Definition: atomics.c:183

◆ pg_atomic_unlocked_write_u32_impl()

◆ pg_atomic_write_u32_impl()

static void pg_atomic_write_u32_impl ( volatile pg_atomic_uint32 ptr,
uint32  val 

Definition at line 55 of file generic.h.

References val, and pg_atomic_uint32::value.

Referenced by pg_atomic_init_u32_impl(), and pg_atomic_unlocked_write_u32_impl().

56 {
57  ptr->value = val;
58 }
long val
Definition: informix.c:689

◆ pg_atomic_write_u64_impl()

static void pg_atomic_write_u64_impl ( volatile pg_atomic_uint64 ptr,
uint64  val 

Definition at line 280 of file generic.h.

Referenced by pg_atomic_init_u64_impl(), and pg_atomic_write_u64().

281 {
282  /*
283  * 64 bit writes aren't safe on all platforms. In the generic
284  * implementation implement them as an atomic exchange.
285  */
286  pg_atomic_exchange_u64_impl(ptr, val);
287 }
long val
Definition: informix.c:689