SDL: coreaudio: Remove redundant variable.

From f6565c329b3f587b76271aa7f4bf72f0acaea643 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Wed, 28 Sep 2022 09:27:45 -0400
Subject: [PATCH] coreaudio: Remove redundant variable.

---
 src/audio/coreaudio/SDL_coreaudio.h | 1 -
 src/audio/coreaudio/SDL_coreaudio.m | 8 +++-----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/audio/coreaudio/SDL_coreaudio.h b/src/audio/coreaudio/SDL_coreaudio.h
index 3bb53555450a..b426ea40458b 100644
--- a/src/audio/coreaudio/SDL_coreaudio.h
+++ b/src/audio/coreaudio/SDL_coreaudio.h
@@ -54,7 +54,6 @@ struct SDL_PrivateAudioData
     AudioStreamBasicDescription strdesc;
     SDL_sem *ready_semaphore;
     char *thread_error;
-    SDL_atomic_t shutdown;
 #if MACOSX_COREAUDIO
     AudioDeviceID deviceID;
     SDL_atomic_t device_change_flag;
diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m
index 7caa3f479af5..de8f72106190 100644
--- a/src/audio/coreaudio/SDL_coreaudio.m
+++ b/src/audio/coreaudio/SDL_coreaudio.m
@@ -532,8 +532,7 @@ static BOOL update_audio_session(_THIS, SDL_bool open, SDL_bool allow_playandrec
 
     SDL_LockMutex(this->mixer_lock);
 
-    /* !!! FIXME: why do we have this->hidden->shutdown when this->shutdown exists? */
-    if (SDL_AtomicGet(&this->hidden->shutdown)) {
+    if (SDL_AtomicGet(&this->shutdown)) {
         SDL_UnlockMutex(this->mixer_lock);
         return;  /* don't do anything, since we don't even want to enqueue this buffer again. */
     }
@@ -734,7 +733,7 @@ static BOOL update_audio_session(_THIS, SDL_bool open, SDL_bool allow_playandrec
     }
 
     if (this->hidden->thread) {
-        SDL_AtomicSet(&this->hidden->shutdown, 1);
+        SDL_assert(SDL_AtomicGet(&this->shutdown) != 0);  /* should have been set by SDL_audio.c */
         SDL_WaitThread(this->hidden->thread, NULL);
     }
 
@@ -981,7 +980,7 @@ static BOOL update_audio_session(_THIS, SDL_bool open, SDL_bool allow_playandrec
     /* init was successful, alert parent thread and start running... */
     SDL_SemPost(this->hidden->ready_semaphore);
 
-    while (!SDL_AtomicGet(&this->hidden->shutdown)) {
+    while (!SDL_AtomicGet(&this->shutdown)) {
         CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.10, 1);
 
         #if MACOSX_COREAUDIO
@@ -1131,7 +1130,6 @@ output device (in which case we'll try again). */
 #endif
 
     /* This has to init in a new thread so it can get its own CFRunLoop. :/ */
-    SDL_AtomicSet(&this->hidden->shutdown, 0);
     this->hidden->ready_semaphore = SDL_CreateSemaphore(0);
     if (!this->hidden->ready_semaphore) {
         return -1;  /* oh well. */