SDL_CompareAndSwapAtomicInt(3)
β¨ SDL_CompareAndSwapAtomicInt(3) β¨
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual π β this one's called SDL_CompareAndSwapAtomicInt and it's giving very careful, very deliberate energy. No cap.
π NAME π
SDL_CompareAndSwapAtomicInt β set an atomic variable to a new value if it is currently an old value. like, only if. it's a conditional baddie. π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_atomic.h>
bool SDL_CompareAndSwapAtomicInt(SDL_AtomicInt *a, int oldval, int newval);
π¦ DESCRIPTION π¦
Note: if you don't know what this function is for, you shouldn't use it! π«Ά
fr fr. this is not a "let me just try it and see" situation. if this function is a mystery to you, that's the universe telling you to walk away, bestie. it's not being mean, it's being honest. π
π FUNCTION PARAMETERS π
aβ a pointer to anSDL_AtomicIntvariable to be modified. that's the glow-up target. β¨oldvalβ the old value. the one it has to be currently, or nothing happens. πnewvalβ the new value. the fit it's gonna change into. π
π RETURN VALUE π
Returns true if the atomic variable was set, false otherwise.
so basically: true = slay, the swap happened. false = nope, it wasn't holding oldval, nothing changed. π€·βοΈ
π THREAD SAFETY π
It is safe to call this function from any thread. π―
every thread, no drama, no "wait your turn". it's atomic, that's literally the whole point. main character energy that plays well with others. π
β AVAILABILITY β
This function is available since SDL 3.2.0. ποΈ
π₯ SEE ALSO π₯
and that's the whole vibe check, bestie. π§ this page came to you from the Simple Directmedia Layer girlies, running SDL 3.4.18, and yes the manual page name is literally just SDL_CompareAndSwapAtomicInt(3) again because the header and footer are extra like that. π stay atomic, stay iconic. πβ¨
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms