Преглед изворни кода

audio: More tweaking of `device->thread_alive`

Ryan C. Gordon пре 2 година
родитељ
комит
0999a090a7
1 измењених фајлова са 2 додато и 0 уклоњено
  1. 2 0
      src/audio/SDL_audio.c

+ 2 - 0
src/audio/SDL_audio.c

@@ -668,6 +668,7 @@ void SDL_AudioThreadFinalize(SDL_AudioDevice *device)
         if (device->thread) {
         if (device->thread) {
             SDL_DetachThread(device->thread);  // no one is waiting for us, just detach ourselves.
             SDL_DetachThread(device->thread);  // no one is waiting for us, just detach ourselves.
             device->thread = NULL;
             device->thread = NULL;
+            SDL_AtomicSet(&device->thread_alive, 0);
         }
         }
         DestroyPhysicalAudioDevice(device);
         DestroyPhysicalAudioDevice(device);
     }
     }
@@ -1085,6 +1086,7 @@ static void ClosePhysicalAudioDevice(SDL_AudioDevice *device)
             SDL_WaitThread(device->thread, NULL);
             SDL_WaitThread(device->thread, NULL);
             device->thread = NULL;
             device->thread = NULL;
         }
         }
+        SDL_AtomicSet(&device->thread_alive, 0);
     }
     }
 
 
     if (device->is_opened) {
     if (device->is_opened) {