Updated the atomic API for SDL 3.0 naming conventions

Fixes https://github.com/libsdl-org/SDL/issues/7388
This commit is contained in:
Sam Lantinga
2024-01-18 03:39:55 -08:00
parent 4e60fc9b2b
commit a2665f54c8
24 changed files with 156 additions and 112 deletions

View File

@@ -33,7 +33,7 @@ SDL_TLSData *SDL_SYS_GetTLSData(void)
{
if (thread_local_storage == INVALID_PTHREAD_KEY && !generic_local_storage) {
static SDL_SpinLock lock;
SDL_AtomicLock(&lock);
SDL_LockSpinlock(&lock);
if (thread_local_storage == INVALID_PTHREAD_KEY && !generic_local_storage) {
pthread_key_t storage;
if (pthread_key_create(&storage, NULL) == 0) {
@@ -43,7 +43,7 @@ SDL_TLSData *SDL_SYS_GetTLSData(void)
generic_local_storage = SDL_TRUE;
}
}
SDL_AtomicUnlock(&lock);
SDL_UnlockSpinlock(&lock);
}
if (generic_local_storage) {
return SDL_Generic_GetTLSData();