SDL Wiki
(This is the documentation for SDL3, which is the current stable version. SDL2 was the previous version!)

SDL_CompilerBarrier

Mark a compiler barrier.

Header File

Defined in <SDL3/SDL_atomic.h>

Syntax

#define SDL_CompilerBarrier() DoCompilerSpecificReadWriteBarrier()

Remarks

A compiler barrier prevents the compiler from reordering reads and writes to globally visible variables across the call.

This macro only prevents the compiler from reordering reads and writes, it does not prevent the CPU from reordering reads and writes. However, all of the atomic operations that modify memory are full memory barriers.

Thread Safety

Obviously this macro is safe to use from any thread at any time, but if you find yourself needing this, you are probably dealing with some very sensitive code; be careful!

Version

This macro is available since SDL 3.1.3.


CategoryAPI, CategoryAPIMacro, CategoryAtomic


[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.