logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

SDL_SetTLS - Set the current thread's value associated with a thread local storage ID.

Availability

       This function is available since SDL 3.2.0.

Description

       If the thread local storage ID is not initialized (the value is 0), a new ID will be created in a thread-
       safe way, so all calls using a pointer to the same ID will refer to the same local storage.

       Note  that replacing a value from a previous call to this function on the same thread does _not_ call the
       previous value's destructor!

       destructor can be NULL; it is assumed that value does not need to be cleaned up if so.

Function Parameters

id     a pointer to the thread local storage ID, may not be NULL.

       value  the value to associate with the ID for the current thread.

       destructor
              a function called when the thread exits, to free the value, may be NULL.

Name

       SDL_SetTLS - Set the current thread's value associated with a thread local storage ID.

Return Value

       for more information.

See Also

SDL_GetTLS(3)

Simple Directmedia Layer                           SDL 3.2.20                                      SDL_SetTLS(3)

Synopsis

#include<SDL3/SDL_thread.h>boolSDL_SetTLS(SDL_TLSID*id,constvoid*value,SDL_TLSDestructorCallbackdestructor);

Thread Safety

       It is safe to call this function from any thread.

See Also