SDL_MemoryBarrierAcquire(3)

πŸ’– SDL_MemoryBarrierAcquire πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we talk about SDL_MemoryBarrierAcquire β€” the macro version of insert a memory acquire barrier. yes. that's the whole vibe. it's a memory barrier. it's acquire flavored. it's a macro. slay. πŸ’…


✨ NAME ✨

SDL_MemoryBarrierAcquire β€” Insert a memory acquire barrier (macro version).

like. that's it. that's the girl. a macro that does barrier things and acquires. πŸŽ€


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_atomic.h>

#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction()

so you include the header, you call the macro with zero arguments, and it expands straight into the function version. zero drama, zero args, just vibes. ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so first things first: please see SDL_MemoryBarrierRelease for the details on what memory barriers are and when to use them. that's where the lore lives. this page is not the lore page, this is the macro page. 🫢

this is the macro version of this functionality. if possible, SDL will use compiler intrinsics or inline assembly, but some platforms might need to call the function version of this β€” SDL_MemoryBarrierAcquireFunction β€” to do the heavy lifting. so like, the macro is the face, the function is the girl doing the actual work behind the scenes. main character energy, honestly. πŸ‘‘

apps that can use the macro should favor it over the function. the macro ate, the function is just there in case the macro can't show up. no cap.


🧚 THREAD SAFETY 🧚

obviously this macro is safe to use from any thread at any time, but β€” and listen closely bestie β€” if you find yourself needing this, you are probably dealing with some very sensitive code; be careful! 😭

like, the thread safety is not the problem. the situation you're in is the problem. this is not a "throw it in and hope" situation, this is a "you know exactly why you're here" situation. respect the barrier. 🫑


πŸ’œ AVAILABILITY πŸ’œ

this macro is available since SDL 3.2.0. so if you're on something older, it's giving ✨not here✨. update, babe. 🌈


⭐ SEE ALSO ⭐


and that's the whole page, bestie!! no bugs noted, no warnings beyond be careful with your sensitive code, and all the deets are exactly where they should be. πŸŽ€

this lil' page came to you from the fine people at Simple Directmedia Layer, documenting SDL 3.4.18, under the header SDL_MemoryBarrierAcquire(3) β€” and that's a wrap, mwah πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from