Skip to content

Commit

Permalink
pulseaudio: Hotplug thread fixes.
Browse files Browse the repository at this point in the history
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.

(cherry-picked from commit b7dc30c)

(cherry picked from commit 58f2586)
  • Loading branch information
icculus authored and slouken committed Sep 12, 2024
1 parent d321899 commit e9efcfb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/audio/pulseaudio/SDL_pulseaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -897,8 +897,12 @@ static void PULSEAUDIO_DetectDevices(void)

/* ok, we have a sane list, let's set up hotplug notifications now... */
SDL_AtomicSet(&pulseaudio_hotplug_thread_active, 1);
pulseaudio_hotplug_thread = SDL_CreateThreadInternal(HotplugThread, "PulseHotplug", 256 * 1024, ready_sem); /* !!! FIXME: this can probably survive in significantly less stack space. */
SDL_SemWait(ready_sem);
pulseaudio_hotplug_thread = SDL_CreateThreadInternal(HotplugThread, "PulseHotplug", 0, ready_sem);
if (pulseaudio_hotplug_thread) {
SDL_SemWait(ready_sem);
} else {
SDL_AtomicSet(&pulseaudio_hotplug_thread_active, 0); // thread failed to start, we'll go on without hotplug.
}
SDL_DestroySemaphore(ready_sem);
}

Expand Down

0 comments on commit e9efcfb

Please sign in to comment.