PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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

◆ PG_HAVE_ATOMIC_INIT_U32

#define PG_HAVE_ATOMIC_INIT_U32

Definition at line 149 of file generic.h.

◆ PG_HAVE_ATOMIC_INIT_U64

#define PG_HAVE_ATOMIC_INIT_U64

Definition at line 337 of file generic.h.

◆ PG_HAVE_ATOMIC_READ_U32

#define PG_HAVE_ATOMIC_READ_U32

Definition at line 44 of file generic.h.

◆ PG_HAVE_ATOMIC_READ_U64

#define PG_HAVE_ATOMIC_READ_U64

Definition at line 301 of file generic.h.

◆ PG_HAVE_ATOMIC_UNLOCKED_WRITE_U32

#define PG_HAVE_ATOMIC_UNLOCKED_WRITE_U32

Definition at line 62 of file generic.h.

◆ PG_HAVE_ATOMIC_WRITE_U32

#define PG_HAVE_ATOMIC_WRITE_U32

Definition at line 53 of file generic.h.

◆ PG_HAVE_ATOMIC_WRITE_U64

#define PG_HAVE_ATOMIC_WRITE_U64

Definition at line 268 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_ 
)
inlinestatic

Definition at line 151 of file generic.h.

152{
153 ptr->value = val_;
154}

References pg_atomic_uint32::value.

Referenced by pg_atomic_init_u32().

◆ pg_atomic_init_u64_impl()

static void pg_atomic_init_u64_impl ( volatile pg_atomic_uint64 ptr,
uint64  val_ 
)
inlinestatic

Definition at line 339 of file generic.h.

340{
341 ptr->value = val_;
342}

References pg_atomic_uint64::value.

◆ pg_atomic_read_u32_impl()

static uint32 pg_atomic_read_u32_impl ( volatile pg_atomic_uint32 ptr)
inlinestatic

Definition at line 46 of file generic.h.

47{
48 return ptr->value;
49}

References pg_atomic_uint32::value.

Referenced by pg_atomic_read_u32().

◆ pg_atomic_read_u64_impl()

static uint64 pg_atomic_read_u64_impl ( volatile pg_atomic_uint64 ptr)
inlinestatic

Definition at line 319 of file generic.h.

320{
321 uint64 old = 0;
322
323 /*
324 * 64-bit reads aren't atomic on all platforms. In the generic
325 * implementation implement them as a compare/exchange with 0. That'll
326 * fail or succeed, but always return the old value. Possibly might store
327 * a 0, but only if the previous value also was a 0 - i.e. harmless.
328 */
330
331 return old;
332}
bool pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 *expected, uint64 newval)
Definition: atomics.c:34
uint64_t uint64
Definition: c.h:489

References pg_atomic_compare_exchange_u64_impl().

Referenced by pg_atomic_monotonic_advance_u64(), and pg_atomic_read_u64().

◆ pg_atomic_unlocked_write_u32_impl()

static void pg_atomic_unlocked_write_u32_impl ( volatile pg_atomic_uint32 ptr,
uint32  val 
)
inlinestatic

Definition at line 64 of file generic.h.

65{
66 ptr->value = val;
67}
long val
Definition: informix.c:689

References val, and pg_atomic_uint32::value.

Referenced by pg_atomic_unlocked_write_u32().

◆ pg_atomic_write_u32_impl()

static void pg_atomic_write_u32_impl ( volatile pg_atomic_uint32 ptr,
uint32  val 
)
inlinestatic

Definition at line 55 of file generic.h.

56{
57 ptr->value = val;
58}

References val, and pg_atomic_uint32::value.

Referenced by pg_atomic_write_u32().

◆ pg_atomic_write_u64_impl()

static void pg_atomic_write_u64_impl ( volatile pg_atomic_uint64 ptr,
uint64  val 
)
inlinestatic

Definition at line 288 of file generic.h.

289{
290 /*
291 * 64 bit writes aren't safe on all platforms. In the generic
292 * implementation implement them as an atomic exchange.
293 */
294 pg_atomic_exchange_u64_impl(ptr, val);
295}

References val.

Referenced by pg_atomic_write_u64().