SDL_SetAtomicPointer(3)

πŸ’– SDL_SetAtomicPointer πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, and today's main character is SDL_SetAtomicPointer(3) πŸŽ€


✨ NAME ✨

SDL_SetAtomicPointer β€” set a pointer to a value, atomically πŸ’…


✨ SYNOPSIS ✨

#include <SDL3/SDL_atomic.h>

void * SDL_SetAtomicPointer(void **a, void *v);

like. look at her. two args, one pointer out. iconic behavior honestly 🫢


✨ DESCRIPTION ✨

ngl the manpage says it best and I'm just the messenger:

Note: If you don't know what this function is for, you shouldn't use it!

and that's not me being shady, that is literally what the docs say 😭 if you read that and went "huh?" then bestie this function is not for you and that is so valid πŸ’€ atomic stuff is giving "know before you go" energy fr fr.


✨ FUNCTION PARAMETERS ✨

  • a β€” a pointer to a pointer πŸͺ† (yes, pointer-ception, we love a nesting moment)
  • v β€” the desired pointer value πŸ’« the thing you wanna put in there

✨ RETURN VALUE ✨

She gives you back the previous value of the pointer πŸ‘‘ like a little time capsule of what was there before you swapped it out.


✨ THREAD SAFETY ✨

It is safe to call this function from any thread 🌈πŸ”₯ go off, every thread, all at once, no cap. that's literally the whole point of the function, and she ate.


✨ AVAILABILITY ✨

This function is available since SDL 3.2.0 ⭐ (so if you're on anything older... ma'am. upgrade. πŸ™ˆ)


✨ SEE ALSO ✨

iykyk β€” go read those two next, they're the rest of the atomic pointer trio and they're all lowkey obsessed with each other πŸ’–


okay that's the whole page, we're done here πŸŽ€ this lil guide came to you from Simple Directmedia Layer, version SDL 3.4.18 β€” periodt, stay atomic bestie πŸ’…βœ¨

πŸ“¦ where this page comes from