SDL_IsMainThread(3)
π SDL_IsMainThread(3) π
okay so we're in the SDL3 FUNCTIONS manual, bestie, and this page is literally about SDL_IsMainThread. It's giving "am I the main character thread?" energy, and honestly? Iconic question. β¨
πΈ NAME πΈ
SDL_IsMainThread β return whether this is the main thread. Like, are you that thread or not? π«Ά
β¨ SYNOPSIS β¨
#include <SDL3/SDL_init.h>
bool SDL_IsMainThread(void);
π¦ DESCRIPTION π¦
So here's the tea, bestie. On Apple platforms, the main thread is the thread that runs your program's main() entry point. Periodt.
On other platforms, the main thread is the one that calls SDL_Init([SDL_INIT_VIDEO](SDL_INIT_VIDEO)), which should usually be the one that runs your program's main() entry point. No cap.
If you are using the main callbacks, SDL_AppInit(), SDL_AppIterate(), and SDL_AppQuit() are all called on the main thread. So yes, they're all chilling on the main thread together. π
π RETURN VALUE π
Returns true if this thread is the main thread, or false otherwise. That's it. Binary. No cap. π
π§ THREAD SAFETY π§
It is safe to call this function from any thread. Slay. β¨
π AVAILABILITY π
This function is available since SDL 3.2.0. So if you're on something older? Ma'am. π
π₯ SEE ALSO π₯
bye bestie π«Ά β Simple Directmedia Layer β’ SDL 3.4.18 β’ SDL_IsMainThread(3)
π¦ 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