SDL_AddAtomicU32(3)

πŸ“¦
version 3.4.18 Β· 5 versions
, in fedora 43, fedora 44

πŸ’– 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 an SDL_AtomicU32 variable 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