mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-18 01:08:16 +00:00
Removed the need for SDL_CreateTLS()
This eliminates the tap dancing needed for allocating TLS slots, we'll automatically allocate them as needed, in a thread-safe way.
This commit is contained in:
@@ -36,14 +36,11 @@ HANDLE SDL_GetWaitableTimer()
|
||||
static SDL_TLSID TLS_timer_handle;
|
||||
HANDLE timer;
|
||||
|
||||
if (!TLS_timer_handle) {
|
||||
TLS_timer_handle = SDL_CreateTLS();
|
||||
}
|
||||
timer = SDL_GetTLS(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_SetTLS(TLS_timer_handle, timer, SDL_CleanupWaitableTimer);
|
||||
SDL_SetTLS(&TLS_timer_handle, timer, SDL_CleanupWaitableTimer);
|
||||
}
|
||||
}
|
||||
return timer;
|
||||
|
Reference in New Issue
Block a user