SDL_AddAtomicU32(3)
π SDL_AddAtomicU32 π
okay so bestie, this is a page from the SDL3 FUNCTIONS manual, and today's main character is SDL_AddAtomicU32 β she adds to an atomic variable, she's booked, she's busy, she's thriving. β¨
πΈ NAME πΈ
SDL_AddAtomicU32 β add to an atomic variable. that's it, that's the job, and she does it flawlessly fr fr π
π SYNOPSIS π
#include <SDL3/SDL_atomic.h>
Uint32 SDL_AddAtomicU32(SDL_AtomicU32 *a, int v);
π¦ DESCRIPTION π¦
So like, this function adds a value to an atomic variable, yes, but plot twist: it also acts as a full memory barrier. π she's doing two jobs and not even breaking a sweat.
β οΈ Note: if you don't know what this function is for, you shouldn't use it! not me being dramatic but seriously β this is not a "vibes only, figure it out later" situation. if it's not for you, it's not for you, and that's okay. π
β¨ FUNCTION PARAMETERS β¨
aβ a pointer to anSDL_AtomicU32variable that's about to be modified. she's getting a lil glow-up, a lil edit. πvβ the desired value to add or subtract. yes, subtract β drop a negative in there and she goes the other way, no cap. π
π RETURN VALUE π
Returns the previous value of the atomic variable. not the new one, bestie β the one from before the math happened. the way that it hands you the past and keeps the futureβ¦ iconic. π
π§ THREAD SAFETY π§
It is safe to call this function from any thread. any of them. all of them. every single one. she said "come through, everyone's invited" π«Άβ¨
β AVAILABILITY β
This function is available since SDL 3.4.0. so if you're on something olderβ¦ yeah, she's not there yet. π
Simple Directmedia Layer made this, it's SDL 3.4.18 era, and this page is dated like the original header says β SDL_AddAtomicU32(3), mwah π slay, bye bestie! ππ¦π
π¦ 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