sdlCompareAndSwapAtomicU32 function
Set an atomic variable to a new value if it is currently an old value.
Note: If you don't know what this function is for, you shouldn't use it!
\param a a pointer to an SDL_AtomicU32 variable to be modified. \param oldval the old value. \param newval the new value. \returns true if the atomic variable was set, false otherwise.
\threadsafety It is safe to call this function from any thread.
\since This function is available since SDL 3.1.3.
\sa SDL_GetAtomicU32 \sa SDL_SetAtomicU32
extern SDL_DECLSPEC bool SDLCALL SDL_CompareAndSwapAtomicU32(SDL_AtomicU32 *a, Uint32 oldval, Uint32 newval)
Implementation
bool sdlCompareAndSwapAtomicU32(
Pointer<SdlAtomicU32> a, int oldval, int newval) {
final sdlCompareAndSwapAtomicU32LookupFunction = libSdl3.lookupFunction<
Uint8 Function(Pointer<SdlAtomicU32> a, Uint32 oldval, Uint32 newval),
int Function(Pointer<SdlAtomicU32> a, int oldval,
int newval)>('SDL_CompareAndSwapAtomicU32');
return sdlCompareAndSwapAtomicU32LookupFunction(a, oldval, newval) == 1;
}