Browse Source

pulseaudio: Hotplug thread fixes.

This used a tiny stack, which apparently upsets Blender for various
technical reasons. Instead, just use the default stack size, which should
give it plenty of space to work.

If the thread failed to create, we would then wait on a semaphore that would
never trigger, so don't do that anymore!

Fixes #10806.
Ryan C. Gordon 7 months ago
parent
commit
b7dc30ca24
1 changed files with 7 additions and 2 deletions
  1. 7 2
      src/audio/pulseaudio/SDL_pulseaudio.c

+ 7 - 2
src/audio/pulseaudio/SDL_pulseaudio.c

@@ -957,8 +957,13 @@ static void PULSEAUDIO_DetectDevices(SDL_AudioDevice **default_playback, SDL_Aud
 
     // ok, we have a sane list, let's set up hotplug notifications now...
     SDL_AtomicSet(&pulseaudio_hotplug_thread_active, 1);
-    pulseaudio_hotplug_thread = SDL_CreateThreadWithStackSize(HotplugThread, "PulseHotplug", 256 * 1024, ready_sem);  // !!! FIXME: this can probably survive in significantly less stack space.
-    SDL_WaitSemaphore(ready_sem);
+    pulseaudio_hotplug_thread = SDL_CreateThread(HotplugThread, "PulseHotplug", ready_sem);
+    if (pulseaudio_hotplug_thread) {
+        SDL_WaitSemaphore(ready_sem);  // wait until the thread hits it's main loop.
+    } else {
+        SDL_AtomicSet(&pulseaudio_hotplug_thread_active, 0);  // thread failed to start, we'll go on without hotplug.
+    }
+
     SDL_DestroySemaphore(ready_sem);
 }