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

@@ -567,7 +567,7 @@ render_thread_fn(void *render_ctx)
thread_data *thread = render_ctx;
while (!done && !thread->done && state->windows[thread->index]) {
if (SDL_AtomicCAS(&thread->suspended, WAIT_STATE_ENTER_SEM, WAIT_STATE_WAITING_ON_SEM)) {
if (SDL_AtomicCompareAndSwap(&thread->suspended, WAIT_STATE_ENTER_SEM, WAIT_STATE_WAITING_ON_SEM)) {
SDL_WaitSemaphore(thread->suspend_sem);
}
render_window(thread->index);
@@ -602,7 +602,7 @@ loop_threaded(void)
if (suspend_when_occluded && event.type == SDL_EVENT_WINDOW_OCCLUDED) {
tdata = GetThreadDataForWindow(event.window.windowID);
if (tdata) {
SDL_AtomicCAS(&tdata->suspended, WAIT_STATE_GO, WAIT_STATE_ENTER_SEM);
SDL_AtomicCompareAndSwap(&tdata->suspended, WAIT_STATE_GO, WAIT_STATE_ENTER_SEM);
}
} else if (suspend_when_occluded && event.type == SDL_EVENT_WINDOW_EXPOSED) {
tdata = GetThreadDataForWindow(event.window.windowID);