Renamed atomic functions to match SDL 3.0 naming convention

This will also allow us to cleanly add atomic operations for other types in the future.
This commit is contained in:
Sam Lantinga
2024-09-16 23:21:31 -07:00
parent f3e419596b
commit 8d223b3037
64 changed files with 496 additions and 472 deletions

View File

@@ -123,8 +123,8 @@ bool SDL_endswith(const char *string, const char *suffix)
bool SDL_ShouldInit(SDL_InitState *state)
{
while (SDL_AtomicGet(&state->status) != SDL_INIT_STATUS_INITIALIZED) {
if (SDL_AtomicCompareAndSwap(&state->status, SDL_INIT_STATUS_UNINITIALIZED, SDL_INIT_STATUS_INITIALIZING)) {
while (SDL_GetAtomicInt(&state->status) != SDL_INIT_STATUS_INITIALIZED) {
if (SDL_CompareAndSwapAtomicInt(&state->status, SDL_INIT_STATUS_UNINITIALIZED, SDL_INIT_STATUS_INITIALIZING)) {
state->thread = SDL_GetCurrentThreadID();
return true;
}
@@ -137,7 +137,7 @@ bool SDL_ShouldInit(SDL_InitState *state)
bool SDL_ShouldQuit(SDL_InitState *state)
{
if (SDL_AtomicCompareAndSwap(&state->status, SDL_INIT_STATUS_INITIALIZED, SDL_INIT_STATUS_UNINITIALIZING)) {
if (SDL_CompareAndSwapAtomicInt(&state->status, SDL_INIT_STATUS_INITIALIZED, SDL_INIT_STATUS_UNINITIALIZING)) {
state->thread = SDL_GetCurrentThreadID();
return true;
}
@@ -149,9 +149,9 @@ void SDL_SetInitialized(SDL_InitState *state, bool initialized)
SDL_assert(state->thread == SDL_GetCurrentThreadID());
if (initialized) {
SDL_AtomicSet(&state->status, SDL_INIT_STATUS_INITIALIZED);
SDL_SetAtomicInt(&state->status, SDL_INIT_STATUS_INITIALIZED);
} else {
SDL_AtomicSet(&state->status, SDL_INIT_STATUS_UNINITIALIZED);
SDL_SetAtomicInt(&state->status, SDL_INIT_STATUS_UNINITIALIZED);
}
}