SDL_ShouldInit(3)
β¨ SDL_ShouldInit β¨
okay bestie, so this one lives in the SDL3 FUNCTIONS corner of the SDL3 man pages, and it's literally called SDL_ShouldInit β like, should we init?? let's find out π
π NAME π
SDL_ShouldInit β return whether initialization should be done. no cap, that's the whole job π«Ά
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_mutex.h>
bool SDL_ShouldInit(SDL_InitState *state);
π¦ DESCRIPTION π¦
So the way this works is: it checks the state you passed in, and if initialization should be done, it sets the status to SDL_INIT_STATUS_INITIALIZING and returns true. periodt β¨
And if another thread is already modifying this state? bestie it does not panic, it just waits until that's done before returning. so polite. so well-behaved. we love a thread-safe queen π
β οΈ important, fr fr: if this function returnstrue, the calling code must callSDL_SetInitialized()to complete the initialization. like, that's not optional. that's the deal. don't leave it hanging π
π FUNCTION PARAMETERS π
stateβ the initialization state to check. that's the vibe check right there π
π RETURN VALUE π
Returns true if initialization needs to be done, false otherwise. iconic binary behavior, no in-between π
π THREAD SAFETY π
It is safe to call this function from any thread. every single one. go off π§
β AVAILABILITY β
This function is available since SDL 3.2.0. so if you're on something older... yeah, she's not there yet π
π₯ SEE ALSO π₯
iykyk β go read those next, they're the whole squad π«Ά
Simple Directmedia Layer Β· SDL 3.4.18 β mwah, that's the version, and this whole page is SDL_ShouldInit(3) π
stay init'd bestie, love u, bye β¨
π¦ 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