PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
fallback.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * fallback.h
4 * Fallback for platforms without 64 bit atomics support. Slower
5 * than native atomics support, but not unusably slow.
6 *
7 * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
9 *
10 * src/include/port/atomics/fallback.h
11 *
12 *-------------------------------------------------------------------------
13 */
14
15/* intentionally no include guards, should only be included by atomics.h */
16#ifndef INSIDE_ATOMICS_H
17# error "should be included via atomics.h"
18#endif
19
20
21#if !defined(PG_HAVE_ATOMIC_U64_SUPPORT)
22
23#define PG_HAVE_ATOMIC_U64_SIMULATION
24
25#define PG_HAVE_ATOMIC_U64_SUPPORT
26typedef struct pg_atomic_uint64
27{
28 int sema;
29 volatile uint64 value;
31
32#define PG_HAVE_ATOMIC_INIT_U64
33extern void pg_atomic_init_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 val_);
34
35#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64
37 uint64 *expected, uint64 newval);
38
39#define PG_HAVE_ATOMIC_FETCH_ADD_U64
41
42#endif /* PG_HAVE_ATOMIC_U64_SUPPORT */
int64_t int64
Definition: c.h:482
uint64_t uint64
Definition: c.h:486
uint64 pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_)
Definition: atomics.c:62
void pg_atomic_init_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 val_)
Definition: atomics.c:24
struct pg_atomic_uint64 pg_atomic_uint64
bool pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 *expected, uint64 newval)
Definition: atomics.c:34
#define newval
volatile uint64 value
Definition: fallback.h:29