SDL_ShouldQuit(3)
π SDL_ShouldQuit π
okay bestie so this one's from the SDL3 FUNCTIONS lineup, section 3, and it's literally the "are we done here??" check. the whole page is called SDL_ShouldQuit, and honestly? iconic name, no notes.
β¨ NAME β¨
SDL_ShouldQuit β returns whether cleanup should be done. that's it, that's the whole vibe check π«Ά
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_mutex.h>
bool SDL_ShouldQuit(SDL_InitState *state);
π DESCRIPTION π
so what's happening here is: this function looks at the state you handed it, and if cleanup should be done, it sets the status to SDL_INIT_STATUS_UNINITIALIZING and returns true. like, it's flagging the whole thing for teardown. main character move.
β οΈ and here's the part you CANNOT skip, bestie: if this function returnstrue, the calling code must callSDL_SetInitialized()to actually complete the cleanup. no cap. it does not finish the job for you β it just starts it. you gotta close the loop yourself. π
π FUNCTION PARAMETERS π
stateβ the initialization state to check. that's the one you're putting under the microscope π
β RETURN VALUE β
returns true if cleanup needs to be done, false otherwise. simple. clean. slay. β¨
π§ THREAD SAFETY π§
it is safe to call this function from any thread. go off, every thread, all at once, we love a function with no drama π
π AVAILABILITY π
this function is available since SDL 3.2.0. so if you're on something older... babe. upgrade. π
π₯ SEE ALSO π₯
SDL_SetInitialized(3)β the one you MUST call when this returnstrue, iykykSDL_ShouldInit(3)β the sibling, the other half of the duo π
and that's the whole page, bestie!! brought to you by the lovely humans at Simple Directmedia Layer β this is SDL 3.4.18, and yes, the page itself is literally called SDL_ShouldQuit(3). go forth and clean up your state properly, you got this π
π
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms