coreaudio: Remove redundant variable.

This commit is contained in:
Ryan C. Gordon 2022-09-28 09:27:45 -04:00
parent 411582c710
commit f6565c329b
No known key found for this signature in database
GPG Key ID: FA148B892AB48044
2 changed files with 3 additions and 6 deletions

View File

@ -54,7 +54,6 @@ struct SDL_PrivateAudioData
AudioStreamBasicDescription strdesc; AudioStreamBasicDescription strdesc;
SDL_sem *ready_semaphore; SDL_sem *ready_semaphore;
char *thread_error; char *thread_error;
SDL_atomic_t shutdown;
#if MACOSX_COREAUDIO #if MACOSX_COREAUDIO
AudioDeviceID deviceID; AudioDeviceID deviceID;
SDL_atomic_t device_change_flag; SDL_atomic_t device_change_flag;

View File

@ -532,8 +532,7 @@ outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffe
SDL_LockMutex(this->mixer_lock); SDL_LockMutex(this->mixer_lock);
/* !!! FIXME: why do we have this->hidden->shutdown when this->shutdown exists? */ if (SDL_AtomicGet(&this->shutdown)) {
if (SDL_AtomicGet(&this->hidden->shutdown)) {
SDL_UnlockMutex(this->mixer_lock); SDL_UnlockMutex(this->mixer_lock);
return; /* don't do anything, since we don't even want to enqueue this buffer again. */ return; /* don't do anything, since we don't even want to enqueue this buffer again. */
} }
@ -734,7 +733,7 @@ COREAUDIO_CloseDevice(_THIS)
} }
if (this->hidden->thread) { 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); SDL_WaitThread(this->hidden->thread, NULL);
} }
@ -981,7 +980,7 @@ audioqueue_thread(void *arg)
/* init was successful, alert parent thread and start running... */ /* init was successful, alert parent thread and start running... */
SDL_SemPost(this->hidden->ready_semaphore); SDL_SemPost(this->hidden->ready_semaphore);
while (!SDL_AtomicGet(&this->hidden->shutdown)) { while (!SDL_AtomicGet(&this->shutdown)) {
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.10, 1); CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.10, 1);
#if MACOSX_COREAUDIO #if MACOSX_COREAUDIO
@ -1131,7 +1130,6 @@ COREAUDIO_OpenDevice(_THIS, const char *devname)
#endif #endif
/* This has to init in a new thread so it can get its own CFRunLoop. :/ */ /* 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); this->hidden->ready_semaphore = SDL_CreateSemaphore(0);
if (!this->hidden->ready_semaphore) { if (!this->hidden->ready_semaphore) {
return -1; /* oh well. */ return -1; /* oh well. */