changeset 38338:c6ff61f9af43

(toplevel): Include <signal.h> and "syssignal.h". (vox_configure, vox_close) [SIGIO]: Block/unblock SIGIO around ioctls.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 09 Jul 2001 17:15:27 +0000
parents e861bf91c070
children 34f0488092e3
files src/sound.c
diffstat 1 files changed, 23 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/sound.c	Mon Jul 09 13:06:36 2001 +0000
+++ b/src/sound.c	Mon Jul 09 17:15:27 2001 +0000
@@ -32,6 +32,8 @@
 #include "lisp.h"
 #include "dispextern.h"
 #include "atimer.h"
+#include <signal.h>
+#include "syssignal.h"
 
 /* FreeBSD has machine/soundcard.h.  Voxware sound driver docs mention
    sys/soundcard.h.  So, let's try whatever's there.  */
@@ -765,7 +767,13 @@
   
   xassert (sd->fd >= 0);
 
+  /* On GNU/Linux, it seems that the device driver doesn't like to be
+     interrupted by a signal.  Block the ones we know to cause
+     troubles.  */
   turn_on_atimers (0);
+#ifdef SIGIO
+  sigblock (sigmask (SIGIO));
+#endif
 
   val = sd->format;
   if (ioctl (sd->fd, SNDCTL_DSP_SETFMT, &sd->format) < 0
@@ -796,6 +804,9 @@
     }
   
   turn_on_atimers (1);
+#ifdef SIGIO
+  sigunblock (sigmask (SIGIO));
+#endif
 }
 
 
@@ -807,10 +818,21 @@
 {
   if (sd->fd >= 0)
     {
-      /* Flush sound data, and reset the device.  */
+      /* On GNU/Linux, it seems that the device driver doesn't like to
+	 be interrupted by a signal.  Block the ones we know to cause
+	 troubles.  */
+#ifdef SIGIO
+      sigblock (sigmask (SIGIO));
+#endif
       turn_on_atimers (0);
+      
+      /* Flush sound data, and reset the device.  */
       ioctl (sd->fd, SNDCTL_DSP_SYNC, NULL);
+      
       turn_on_atimers (1);
+#ifdef SIGIO
+      sigunblock (sigmask (SIGIO));
+#endif
 
       /* Close the device.  */
       emacs_close (sd->fd);