SDL_GetTLS(3)
π SDL_GetTLS π
okay bestie, welcome to the SDL3 FUNCTIONS section, we're talking about SDL_GetTLS and honestly it's giving "little function, big feelings."
β¨ NAME β¨
SDL_GetTLS β get the current thread's value associated with a thread local storage ID π§΅π
like. it fetches your thread's lil stash. nobody else's. just yours. periodt.
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_thread.h>
void * SDL_GetTLS(SDL_TLSID *id);
there she is. one function, one pointer in, one pointer out. iconic behavior fr fr π
π¦ FUNCTION PARAMETERS π¦
idβ a pointer to the thread local storage ID, and bestie listen to me: it may not beNULL. do not passNULL. that's not a vibe check you wanna fail π
β RETURN VALUE β
It returns the value associated with the ID for the current thread, or NULL if no value has been set.
and if you get NULL and you're like "wait was that an error or was that just empty π₯Ί" β call SDL_GetError() for more information. she'll tell you what's up, no cap.
nglNULLhere is doing double duty: "nothing was set" and possibly "something went wrong." that's why you gotta go askSDL_GetError(). it's giving mysterious on purpose π
π THREAD SAFETY π
It is safe to call this function from any thread. literally any thread. every thread. all the threads. main character energy for every single one of them π
π AVAILABILITY π
This function is available since SDL 3.2.0. so if you're on something older, sorry babe, this one's not for you yet π«Ά
π SEE ALSO π
SDL_SetTLS(3)β the other half of the duo, the one that puts the value there in the first place. you two are a matching set, iykyk π
and that's the whole page, bestie!! written up under the Simple Directmedia Layer umbrella, for SDL 3.4.18 β mwah, go forth and thread-local-storage responsibly πβ¨ππ¦
π¦ 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