SDL_SetAtomicU32(3)

✨ SDL_SetAtomicU32 ✨

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where today's main character is SDL_SetAtomicU32 πŸ’…


🌸 NAME 🌸

SDL_SetAtomicU32 β€” set an atomic variable to a value, no drama, no cap 🫢


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_atomic.h>

Uint32 SDL_SetAtomicU32(SDL_AtomicU32 *a, Uint32 v);

πŸ’– DESCRIPTION πŸ’–

So like, this function sets your atomic variable to a value. That's the whole vibe. iconic πŸ¦‹

But the way that this function ALSO acts as a full memory barrier?? yes, she's doing double duty, she's got main character energy AND a job ✨

⚠️ Note: if you don't know what this function is for, you shouldn't use it! like genuinely, bestie, this is not the time to experiment πŸ™ˆ

πŸ“ FUNCTION PARAMETERS πŸ“

  • a β€” a pointer to an SDL_AtomicU32 variable to be modified. she's the one getting changed πŸ’œ
  • v β€” the desired value. the glow-up she's getting 🌈

⭐ RETURN VALUE ⭐

Returns the previous value of the atomic variable. like, she'll tell you what she looked like before, lowkey nostalgic 😭


🧚 THREAD SAFETY 🧚

It is safe to call this function from any thread. every thread is welcome at this sleepover, no gatekeeping πŸ‘‘


🌸 AVAILABILITY 🌸

This function is available since SDL 3.2.0. so if you're on anything older... ngl, you're out of luck πŸ’€


πŸ”₯ SEE ALSO πŸ”₯


mwah πŸ’‹ that's the page! brought to you by Simple Directmedia Layer, running on SDL 3.4.18 β€” go forth and atomically set things, bestie, and remember: memory barriers are self-care πŸŒΈβœ¨πŸŽ€

πŸ“¦ where this page comes from