sdlAtomicCasPtr function

bool sdlAtomicCasPtr(
  1. Pointer<Pointer<NativeType>> a,
  2. Pointer<NativeType> oldval,
  3. Pointer<NativeType> newval
)

Set a pointer 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 a pointer \param oldval the old pointer value \param newval the new pointer value \returns SDL_TRUE if the pointer was set, SDL_FALSE otherwise.

\since This function is available since SDL 2.0.0.

\sa SDL_AtomicCAS \sa SDL_AtomicGetPtr \sa SDL_AtomicSetPtr

extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void **a, void *oldval, void *newval)

Implementation

bool sdlAtomicCasPtr(Pointer<Pointer<NativeType>> a, Pointer<NativeType> oldval,
    Pointer<NativeType> newval) {
  final sdlAtomicCasPtrLookupFunction = libSdl2.lookupFunction<
      Int32 Function(Pointer<Pointer<NativeType>> a, Pointer<NativeType> oldval,
          Pointer<NativeType> newval),
      int Function(Pointer<Pointer<NativeType>> a, Pointer<NativeType> oldval,
          Pointer<NativeType> newval)>('SDL_AtomicCASPtr');
  return sdlAtomicCasPtrLookupFunction(a, oldval, newval) == 1;
}