--- a/sc2src/alsadirect.cpp
+++ b/sc2src/alsadirect.cpp
@@ -160,6 +160,9 @@
         // be necessary, in synchronous mode, alsa is supposed to
         // perform complete writes except for errors or interrupts
         while (frames > 0) {
+            if (g_quitrequest) {
+                break;
+            }
             if (snd_pcm_delay(pcm, &alsa_delay) < 0) {
                 alsa_delay = 0;
             }
@@ -716,6 +719,9 @@
     alsaqueue.start(1, alsawriter, 0);
 
     while (true) {
+        if (g_quitrequest) {
+            goto done;
+        }
         AudioMessage *tsk = 0;
         // Get new data
         if (!queue->take(&tsk)) {