DOKK / manpages / debian 13 / libsdl3-doc / SDL_CPUPauseInstruction.3.en
SDL_CPUPauseInstruction(3) SDL3 FUNCTIONS SDL_CPUPauseInstruction(3)

SDL_CPUPauseInstruction - A macro to insert a CPU-specific "pause" instruction into the program.

Defined in SDL3/SDL_atomic.h

#include "SDL3/SDL.h"
#define SDL_CPUPauseInstruction() DoACPUPauseInACompilerAndArchitectureSpecificWay

This can be useful in busy-wait loops, as it serves as a hint to the CPU as to the program's intent; some CPUs can use this to do more efficient processing. On some platforms, this doesn't do anything, so using this macro might just be a harmless no-op.

Note that if you are busy-waiting, there are often more-efficient approaches with other synchronization primitives: mutexes, semaphores, condition variables, etc.

This macro is safe to use from any thread.

This macro is available since SDL 3.2.0.

SDL 3.2.10 Simple Directmedia Layer