# SDL: DOS: yield audio thread even when the ring buffer has space

**URL:** <https://discourse.libsdl.org/t/sdl-dos-yield-audio-thread-even-when-the-ring-buffer-has-space/69270>\
**Category:** SDL Commits\
**Created:** [September 10, 2026, 4:02pm UTC](https://discourse.libsdl.org/t/sdl-dos-yield-audio-thread-even-when-the-ring-buffer-has-space/69270 "2026-09-10T16:02:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [September 10, 2026, 4:02pm UTC](https://discourse.libsdl.org/t/sdl-dos-yield-audio-thread-even-when-the-ring-buffer-has-space/69270/1 "2026-09-10T16:02:54Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/ce85ee87f61527c4615beb69e21713e098c5738b>

```diff
From ce85ee87f61527c4615beb69e21713e098c5738b Mon Sep 17 00:00:00 2001
From: x0r <[EMAIL REDACTED]>
Date: Thu, 10 Sep 2026 16:19:40 +0200
Subject: [PATCH] DOS: yield audio thread even when the ring buffer has space

---
 src/audio/dos/SDL_dosaudio_sb.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/audio/dos/SDL_dosaudio_sb.c b/src/audio/dos/SDL_dosaudio_sb.c
index bf53adec4fe1e..2958c5609da94 100644
--- a/src/audio/dos/SDL_dosaudio_sb.c
+++ b/src/audio/dos/SDL_dosaudio_sb.c
@@ -170,6 +170,10 @@ static bool DOSSOUNDBLASTER_WaitDevice(SDL_AudioDevice *device)
     struct SDL_PrivateAudioData *hidden = device->hidden;
     const int size = hidden->ring_size;
 
+ // Slow mixing can keep the ring below capacity indefinitely. Yield even
+ // when there is room so the cooperative main thread can process events.
+ DOS_Yield();
+
     for (;;) {
         // Available space = ring_size - (write - read).
         // ring_write is ours (audio thread only), ring_read is advanced by

```
