diff --git a/include/SDL_thread.h b/include/SDL_thread.h index 49168c52f..be0601cc9 100644 --- a/include/SDL_thread.h +++ b/include/SDL_thread.h @@ -435,6 +435,10 @@ extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id); */ extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void*)); +/** + * \brief Cleanup all TLS data for this thread. + */ +extern DECLSPEC void SDLCALL SDL_TLSCleanup(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index 085156e8b..2d35d5f9b 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -809,3 +809,4 @@ #define SDL_isgraph SDL_isgraph_REAL #define SDL_AndroidShowToast SDL_AndroidShowToast_REAL #define SDL_GetAudioDeviceSpec SDL_GetAudioDeviceSpec_REAL +#define SDL_TLSCleanup SDL_TLSCleanup_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 1cd285393..6d89825f0 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -874,3 +874,4 @@ SDL_DYNAPI_PROC(int,SDL_isgraph,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_AndroidShowToast,(const char *a, int b, int c, int d, int e),(a,b,c,d,e),return) #endif SDL_DYNAPI_PROC(int,SDL_GetAudioDeviceSpec,(int a, int b, SDL_AudioSpec *c),(a,b,c),return) +SDL_DYNAPI_PROC(void,SDL_TLSCleanup,(void),(),) diff --git a/src/thread/SDL_thread.c b/src/thread/SDL_thread.c index 05c05ce49..438612c24 100644 --- a/src/thread/SDL_thread.c +++ b/src/thread/SDL_thread.c @@ -82,7 +82,7 @@ SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void *)) return 0; } -static void +void SDL_TLSCleanup() { SDL_TLSData *storage;