1#ifndef SDL3PP_ATOMIC_H_
2#define SDL3PP_ATOMIC_H_
4#include <SDL3/SDL_atomic.h>
5#include "SDL3pp_stdinc.h"
109#define SDL_CompilerBarrier() DoCompilerSpecificReadWriteBarrier()
145#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction()
167#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction()
185#define SDL_CPUPauseInstruction() \
186 DoACPUPauseInACompilerAndArchitectureSpecificWay
357 return SDL_CompareAndSwapAtomicInt(a, oldval, newval);
385 return SDL_SetAtomicInt(a, v);
430 return SDL_AddAtomicInt(a, v);
662 return SDL_CompareAndSwapAtomicU32(a, oldval, newval);
690 return SDL_SetAtomicU32(a, v);
717 return SDL_CompareAndSwapAtomicPointer(&m_value, oldval, newval);
723 return SDL_SetAtomicPointer(&m_value, v);
729 return SDL_GetAtomicPointer(&m_value);
A type representing an atomic of an arbitrary pointer.
Definition: SDL3pp_atomic.h:570
constexpr AtomicPointer(T *value)
Construcst from T.
Definition: SDL3pp_atomic.h:575
SDL_AtomicU32 AtomicU32Raw
Alias to raw representation for AtomicU32.
Definition: SDL3pp_atomic.h:46
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:665
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:360
T * Get()
Get the value of a pointer atomically.
Definition: SDL3pp_atomic.h:727
int Add(int v)
Add to an atomic variable.
Definition: SDL3pp_atomic.h:433
bool AtomicIncRef(AtomicIntRaw *a)
Increment an atomic variable used as a reference count.
Definition: SDL3pp_atomic.h:449
T * Set(T *v)
Set a pointer to a value atomically.
Definition: SDL3pp_atomic.h:721
bool AtomicDecRef()
Decrement an atomic variable used as a reference count.
Definition: SDL3pp_atomic.h:470
int GetAtomicInt(AtomicIntRaw *a)
Get the value of an atomic variable.
Definition: SDL3pp_atomic.h:405
bool AtomicDecRef(AtomicIntRaw *a)
Decrement an atomic variable used as a reference count.
Definition: SDL3pp_atomic.h:468
SDL_AtomicInt AtomicIntRaw
Alias to raw representation for AtomicInt.
Definition: SDL3pp_atomic.h:40
Uint32 Set(Uint32 v)
Set an atomic variable to a value.
Definition: SDL3pp_atomic.h:693
int Get()
Get the value of an atomic variable.
Definition: SDL3pp_atomic.h:407
Uint32 GetAtomicU32(AtomicU32Raw *a)
Get the value of an atomic variable.
Definition: SDL3pp_atomic.h:710
Uint32 SetAtomicU32(AtomicU32Raw *a, Uint32 v)
Set an atomic variable to a value.
Definition: SDL3pp_atomic.h:688
bool CompareAndSwap(T *oldval, T *newval)
Set a pointer to a new value if it is currently an old value.
Definition: SDL3pp_atomic.h:715
bool AtomicIncRef()
Increment an atomic variable used as a reference count.
Definition: SDL3pp_atomic.h:451
int SetAtomicInt(AtomicIntRaw *a, int v)
Set an atomic variable to a value.
Definition: SDL3pp_atomic.h:383
int Set(int v)
Set an atomic variable to a value.
Definition: SDL3pp_atomic.h:388
void MemoryBarrierAcquire()
Insert a memory acquire barrier (function version).
Definition: SDL3pp_atomic.h:89
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:355
void MemoryBarrierRelease()
Insert a memory release barrier (function version).
Definition: SDL3pp_atomic.h:69
Uint32 Get()
Get the value of an atomic variable.
Definition: SDL3pp_atomic.h:712
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:658
int AddAtomicInt(AtomicIntRaw *a, int v)
Add to an atomic variable.
Definition: SDL3pp_atomic.h:428
::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:216
constexpr AtomicInt(int value)
Wraps AtomicInt.
Definition: SDL3pp_atomic.h:222
A type representing an atomic unsigned 32-bit value.
Definition: SDL3pp_atomic.h:497
constexpr AtomicU32(Uint32 value)
Wraps value.
Definition: SDL3pp_atomic.h:503