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 returns true, the calling code must call SDL_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 πŸ”₯


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