mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-07-12 04:09:48 +00:00
SDL API renaming: SDL TLS functions
Fixes https://github.com/libsdl-org/SDL/issues/7743
This commit is contained in:
@@ -506,7 +506,7 @@ void SDL_Quit(void)
|
||||
*/
|
||||
SDL_memset(SDL_SubsystemRefCount, 0x0, sizeof(SDL_SubsystemRefCount));
|
||||
|
||||
SDL_TLSCleanup();
|
||||
SDL_CleanupTLS();
|
||||
|
||||
SDL_bInMainQuit = SDL_FALSE;
|
||||
}
|
||||
|
||||
@@ -634,10 +634,10 @@ SDL3_0.0.0 {
|
||||
SDL_StopTextInput;
|
||||
SDL_SurfaceHasColorKey;
|
||||
SDL_SurfaceHasRLE;
|
||||
SDL_TLSCleanup;
|
||||
SDL_TLSCreate;
|
||||
SDL_TLSGet;
|
||||
SDL_TLSSet;
|
||||
SDL_CleanupTLS;
|
||||
SDL_CreateTLS;
|
||||
SDL_GetTLS;
|
||||
SDL_SetTLS;
|
||||
SDL_TextInputActive;
|
||||
SDL_TextInputShown;
|
||||
SDL_ThreadID;
|
||||
|
||||
@@ -658,10 +658,10 @@
|
||||
#define SDL_StopTextInput SDL_StopTextInput_REAL
|
||||
#define SDL_SurfaceHasColorKey SDL_SurfaceHasColorKey_REAL
|
||||
#define SDL_SurfaceHasRLE SDL_SurfaceHasRLE_REAL
|
||||
#define SDL_TLSCleanup SDL_TLSCleanup_REAL
|
||||
#define SDL_TLSCreate SDL_TLSCreate_REAL
|
||||
#define SDL_TLSGet SDL_TLSGet_REAL
|
||||
#define SDL_TLSSet SDL_TLSSet_REAL
|
||||
#define SDL_CleanupTLS SDL_CleanupTLS_REAL
|
||||
#define SDL_CreateTLS SDL_CreateTLS_REAL
|
||||
#define SDL_GetTLS SDL_GetTLS_REAL
|
||||
#define SDL_SetTLS SDL_SetTLS_REAL
|
||||
#define SDL_TextInputActive SDL_TextInputActive_REAL
|
||||
#define SDL_TextInputShown SDL_TextInputShown_REAL
|
||||
#define SDL_ThreadID SDL_ThreadID_REAL
|
||||
|
||||
@@ -713,10 +713,10 @@ SDL_DYNAPI_PROC(void,SDL_StartTextInput,(void),(),)
|
||||
SDL_DYNAPI_PROC(void,SDL_StopTextInput,(void),(),)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_SurfaceHasColorKey,(SDL_Surface *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_SurfaceHasRLE,(SDL_Surface *a),(a),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_TLSCleanup,(void),(),)
|
||||
SDL_DYNAPI_PROC(SDL_TLSID,SDL_TLSCreate,(void),(),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_TLSGet,(SDL_TLSID a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_TLSSet,(SDL_TLSID a, const void *b, void (SDLCALL *c)(void*)),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_CleanupTLS,(void),(),)
|
||||
SDL_DYNAPI_PROC(SDL_TLSID,SDL_CreateTLS,(void),(),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_GetTLS,(SDL_TLSID a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetTLS,(SDL_TLSID a, const void *b, void (SDLCALL *c)(void*)),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_TextInputActive,(void),(),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_TextInputShown,(void),(),return)
|
||||
SDL_DYNAPI_PROC(SDL_threadID,SDL_ThreadID,(void),(),return)
|
||||
|
||||
@@ -26,13 +26,13 @@
|
||||
#include "SDL_systhread.h"
|
||||
#include "../SDL_error_c.h"
|
||||
|
||||
SDL_TLSID SDL_TLSCreate(void)
|
||||
SDL_TLSID SDL_CreateTLS(void)
|
||||
{
|
||||
static SDL_AtomicInt SDL_tls_id;
|
||||
return SDL_AtomicIncRef(&SDL_tls_id) + 1;
|
||||
}
|
||||
|
||||
void *SDL_TLSGet(SDL_TLSID id)
|
||||
void *SDL_GetTLS(SDL_TLSID id)
|
||||
{
|
||||
SDL_TLSData *storage;
|
||||
|
||||
@@ -43,7 +43,7 @@ void *SDL_TLSGet(SDL_TLSID id)
|
||||
return storage->array[id - 1].data;
|
||||
}
|
||||
|
||||
int SDL_TLSSet(SDL_TLSID id, const void *value, void(SDLCALL *destructor)(void *))
|
||||
int SDL_SetTLS(SDL_TLSID id, const void *value, void(SDLCALL *destructor)(void *))
|
||||
{
|
||||
SDL_TLSData *storage;
|
||||
|
||||
@@ -76,7 +76,7 @@ int SDL_TLSSet(SDL_TLSID id, const void *value, void(SDLCALL *destructor)(void *
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SDL_TLSCleanup(void)
|
||||
void SDL_CleanupTLS(void)
|
||||
{
|
||||
SDL_TLSData *storage;
|
||||
|
||||
@@ -224,7 +224,7 @@ SDL_error *SDL_GetErrBuf(void)
|
||||
const SDL_error *ALLOCATION_IN_PROGRESS = (SDL_error *)-1;
|
||||
SDL_error *errbuf;
|
||||
|
||||
/* tls_being_created is there simply to prevent recursion if SDL_TLSCreate() fails.
|
||||
/* tls_being_created is there simply to prevent recursion if SDL_CreateTLS() fails.
|
||||
It also means it's possible for another thread to also use SDL_global_errbuf,
|
||||
but that's very unlikely and hopefully won't cause issues.
|
||||
*/
|
||||
@@ -233,7 +233,7 @@ SDL_error *SDL_GetErrBuf(void)
|
||||
if (!tls_errbuf) {
|
||||
SDL_TLSID slot;
|
||||
tls_being_created = SDL_TRUE;
|
||||
slot = SDL_TLSCreate();
|
||||
slot = SDL_CreateTLS();
|
||||
tls_being_created = SDL_FALSE;
|
||||
SDL_MemoryBarrierRelease();
|
||||
tls_errbuf = slot;
|
||||
@@ -245,7 +245,7 @@ SDL_error *SDL_GetErrBuf(void)
|
||||
}
|
||||
|
||||
SDL_MemoryBarrierAcquire();
|
||||
errbuf = (SDL_error *)SDL_TLSGet(tls_errbuf);
|
||||
errbuf = (SDL_error *)SDL_GetTLS(tls_errbuf);
|
||||
if (errbuf == ALLOCATION_IN_PROGRESS) {
|
||||
return SDL_GetStaticErrBuf();
|
||||
}
|
||||
@@ -258,16 +258,16 @@ SDL_error *SDL_GetErrBuf(void)
|
||||
SDL_GetOriginalMemoryFunctions(NULL, NULL, &realloc_func, &free_func);
|
||||
|
||||
/* Mark that we're in the middle of allocating our buffer */
|
||||
SDL_TLSSet(tls_errbuf, ALLOCATION_IN_PROGRESS, NULL);
|
||||
SDL_SetTLS(tls_errbuf, ALLOCATION_IN_PROGRESS, NULL);
|
||||
errbuf = (SDL_error *)realloc_func(NULL, sizeof(*errbuf));
|
||||
if (errbuf == NULL) {
|
||||
SDL_TLSSet(tls_errbuf, NULL, NULL);
|
||||
SDL_SetTLS(tls_errbuf, NULL, NULL);
|
||||
return SDL_GetStaticErrBuf();
|
||||
}
|
||||
SDL_zerop(errbuf);
|
||||
errbuf->realloc_func = realloc_func;
|
||||
errbuf->free_func = free_func;
|
||||
SDL_TLSSet(tls_errbuf, errbuf, SDL_FreeErrBuf);
|
||||
SDL_SetTLS(tls_errbuf, errbuf, SDL_FreeErrBuf);
|
||||
}
|
||||
return errbuf;
|
||||
#endif /* SDL_THREADS_DISABLED */
|
||||
@@ -290,7 +290,7 @@ void SDL_RunThread(SDL_Thread *thread)
|
||||
*statusloc = userfunc(userdata);
|
||||
|
||||
/* Clean up thread-local storage */
|
||||
SDL_TLSCleanup();
|
||||
SDL_CleanupTLS();
|
||||
|
||||
/* Mark us as ready to be joined (or detached) */
|
||||
if (!SDL_AtomicCAS(&thread->state, SDL_THREAD_STATE_ALIVE, SDL_THREAD_STATE_ZOMBIE)) {
|
||||
|
||||
@@ -37,13 +37,13 @@ HANDLE SDL_GetWaitableTimer()
|
||||
HANDLE timer;
|
||||
|
||||
if (!TLS_timer_handle) {
|
||||
TLS_timer_handle = SDL_TLSCreate();
|
||||
TLS_timer_handle = SDL_CreateTLS();
|
||||
}
|
||||
timer = SDL_TLSGet(TLS_timer_handle);
|
||||
timer = SDL_GetTLS(TLS_timer_handle);
|
||||
if (!timer) {
|
||||
timer = CreateWaitableTimerExW(NULL, NULL, CREATE_WAITABLE_TIMER_HIGH_RESOLUTION, TIMER_ALL_ACCESS);
|
||||
if (timer) {
|
||||
SDL_TLSSet(TLS_timer_handle, timer, SDL_CleanupWaitableTimer);
|
||||
SDL_SetTLS(TLS_timer_handle, timer, SDL_CleanupWaitableTimer);
|
||||
}
|
||||
}
|
||||
return timer;
|
||||
|
||||
@@ -521,8 +521,8 @@ int SDL_VideoInit(const char *driver_name)
|
||||
_this->gl_config.dll_handle = NULL;
|
||||
SDL_GL_ResetAttributes();
|
||||
|
||||
_this->current_glwin_tls = SDL_TLSCreate();
|
||||
_this->current_glctx_tls = SDL_TLSCreate();
|
||||
_this->current_glwin_tls = SDL_CreateTLS();
|
||||
_this->current_glctx_tls = SDL_CreateTLS();
|
||||
|
||||
/* Initialize the video subsystem */
|
||||
if (_this->VideoInit(_this) < 0) {
|
||||
@@ -4357,8 +4357,8 @@ SDL_GLContext SDL_GL_CreateContext(SDL_Window *window)
|
||||
if (ctx) {
|
||||
_this->current_glwin = window;
|
||||
_this->current_glctx = ctx;
|
||||
SDL_TLSSet(_this->current_glwin_tls, window, NULL);
|
||||
SDL_TLSSet(_this->current_glctx_tls, ctx, NULL);
|
||||
SDL_SetTLS(_this->current_glwin_tls, window, NULL);
|
||||
SDL_SetTLS(_this->current_glctx_tls, ctx, NULL);
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
@@ -4393,8 +4393,8 @@ int SDL_GL_MakeCurrent(SDL_Window *window, SDL_GLContext context)
|
||||
if (retval == 0) {
|
||||
_this->current_glwin = window;
|
||||
_this->current_glctx = context;
|
||||
SDL_TLSSet(_this->current_glwin_tls, window, NULL);
|
||||
SDL_TLSSet(_this->current_glctx_tls, context, NULL);
|
||||
SDL_SetTLS(_this->current_glwin_tls, window, NULL);
|
||||
SDL_SetTLS(_this->current_glctx_tls, context, NULL);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
@@ -4405,7 +4405,7 @@ SDL_Window *SDL_GL_GetCurrentWindow(void)
|
||||
SDL_UninitializedVideo();
|
||||
return NULL;
|
||||
}
|
||||
return (SDL_Window *)SDL_TLSGet(_this->current_glwin_tls);
|
||||
return (SDL_Window *)SDL_GetTLS(_this->current_glwin_tls);
|
||||
}
|
||||
|
||||
SDL_GLContext SDL_GL_GetCurrentContext(void)
|
||||
@@ -4414,7 +4414,7 @@ SDL_GLContext SDL_GL_GetCurrentContext(void)
|
||||
SDL_UninitializedVideo();
|
||||
return NULL;
|
||||
}
|
||||
return (SDL_GLContext)SDL_TLSGet(_this->current_glctx_tls);
|
||||
return (SDL_GLContext)SDL_GetTLS(_this->current_glctx_tls);
|
||||
}
|
||||
|
||||
SDL_EGLDisplay SDL_EGL_GetCurrentEGLDisplay(void)
|
||||
|
||||
Reference in New Issue
Block a user