1#ifndef SDL3PP_ATOMIC_H_
2#define SDL3PP_ATOMIC_H_
4#include <SDL3/SDL_atomic.h>
5#include "SDL3pp_stdinc.h"
6#include "SDL3pp_version.h"
90 SDL_MemoryBarrierReleaseFunction();
113 SDL_MemoryBarrierAcquireFunction();
361 return SDL_CompareAndSwapAtomicInt(a, oldval, newval);
389 return SDL_SetAtomicInt(a, v);
434 return SDL_AddAtomicInt(a, v);
572#if SDL_VERSION_ATLEAST(3, 4, 0)
689 return SDL_CompareAndSwapAtomicU32(a, oldval, newval);
717 return SDL_SetAtomicU32(a, v);
741#if SDL_VERSION_ATLEAST(3, 4, 0)
761 return SDL_AddAtomicU32(a, v);
771 return SDL_CompareAndSwapAtomicPointer(&m_value, oldval, newval);
777 return SDL_SetAtomicPointer(&m_value, v);
783 return SDL_GetAtomicPointer(&m_value);
A type representing an atomic of an arbitrary pointer.
Definition: SDL3pp_atomic.h:597
constexpr AtomicPointer(T *value)
Construcst from T.
Definition: SDL3pp_atomic.h:602
SDL_AtomicU32 AtomicU32Raw
Alias to raw representation for AtomicU32.
Definition: SDL3pp_atomic.h:47
bool CompareAndSwap(Uint32 oldval, Uint32 newval)
Set an atomic variable to a new value if it is currently an old value.
Definition: SDL3pp_atomic.h:692
bool CompareAndSwap(int oldval, int newval)
Set an atomic variable to a new value if it is currently an old value.
Definition: SDL3pp_atomic.h:364
T * Get()
Get the value of a pointer atomically.
Definition: SDL3pp_atomic.h:781
int Add(int v)
Add to an atomic variable.
Definition: SDL3pp_atomic.h:437
bool AtomicIncRef(AtomicIntRaw *a)
Increment an atomic variable used as a reference count.
Definition: SDL3pp_atomic.h:454
T * Set(T *v)
Set a pointer to a value atomically.
Definition: SDL3pp_atomic.h:775
bool AtomicDecRef()
Decrement an atomic variable used as a reference count.
Definition: SDL3pp_atomic.h:476
void MemoryBarrierReleaseFunction()
Insert a memory release barrier (function version).
Definition: SDL3pp_atomic.h:88
int GetAtomicInt(AtomicIntRaw *a)
Get the value of an atomic variable.
Definition: SDL3pp_atomic.h:409
bool AtomicDecRef(AtomicIntRaw *a)
Decrement an atomic variable used as a reference count.
Definition: SDL3pp_atomic.h:474
Uint32 Add(int v)
Add to an atomic variable.
Definition: SDL3pp_atomic.h:764
SDL_AtomicInt AtomicIntRaw
Alias to raw representation for AtomicInt.
Definition: SDL3pp_atomic.h:41
Uint32 Set(Uint32 v)
Set an atomic variable to a value.
Definition: SDL3pp_atomic.h:720
int Get()
Get the value of an atomic variable.
Definition: SDL3pp_atomic.h:411
SDL_FORCE_INLINE void MemoryBarrierAcquire()
Insert a memory acquire barrier.
Definition: SDL3pp_atomic.h:172
Uint32 GetAtomicU32(AtomicU32Raw *a)
Get the value of an atomic variable.
Definition: SDL3pp_atomic.h:737
void MemoryBarrierAcquireFunction()
Insert a memory acquire barrier (function version).
Definition: SDL3pp_atomic.h:111
SDL_FORCE_INLINE void MemoryBarrierRelease()
Insert a memory release barrier.
Definition: SDL3pp_atomic.h:150
Uint32 SetAtomicU32(AtomicU32Raw *a, Uint32 v)
Set an atomic variable to a value.
Definition: SDL3pp_atomic.h:715
bool CompareAndSwap(T *oldval, T *newval)
Set a pointer to a new value if it is currently an old value.
Definition: SDL3pp_atomic.h:769
bool AtomicIncRef()
Increment an atomic variable used as a reference count.
Definition: SDL3pp_atomic.h:456
int SetAtomicInt(AtomicIntRaw *a, int v)
Set an atomic variable to a value.
Definition: SDL3pp_atomic.h:387
Uint32 AddAtomicU32(AtomicU32Raw *a, int v)
Add to an atomic variable.
Definition: SDL3pp_atomic.h:759
SDL_FORCE_INLINE void CompilerBarrier()
Mark a compiler barrier.
Definition: SDL3pp_atomic.h:68
int Set(int v)
Set an atomic variable to a value.
Definition: SDL3pp_atomic.h:392
SDL_FORCE_INLINE void CPUPauseInstruction()
A function to insert a CPU-specific "pause" instruction into the program.
Definition: SDL3pp_atomic.h:190
bool CompareAndSwapAtomicInt(AtomicIntRaw *a, int oldval, int newval)
Set an atomic variable to a new value if it is currently an old value.
Definition: SDL3pp_atomic.h:359
Uint32 Get()
Get the value of an atomic variable.
Definition: SDL3pp_atomic.h:739
bool CompareAndSwapAtomicU32(AtomicU32Raw *a, Uint32 oldval, Uint32 newval)
Set an atomic variable to a new value if it is currently an old value.
Definition: SDL3pp_atomic.h:685
int AddAtomicInt(AtomicIntRaw *a, int v)
Add to an atomic variable.
Definition: SDL3pp_atomic.h:432
::Uint32 Uint32
An unsigned 32-bit integer type.
Definition: SDL3pp_stdinc.h:341
Main include header for the SDL3pp library.
A type representing an atomic integer value.
Definition: SDL3pp_atomic.h:218
constexpr AtomicInt(int value)
Wraps AtomicInt.
Definition: SDL3pp_atomic.h:224
A type representing an atomic unsigned 32-bit value.
Definition: SDL3pp_atomic.h:503
constexpr AtomicU32(Uint32 value)
Wraps value.
Definition: SDL3pp_atomic.h:509