summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2001-07-09 17:15:48 +0000
committerGerd Moellmann <gerd@gnu.org>2001-07-09 17:15:48 +0000
commitbb6e8cee927dfdc3545aabc6a23eb4d6c5f3268b (patch)
tree9e6b1bce2f93e50505b05445ff144c996941c456
parent4033ae9d5104d794dc9957b1df5ec7808a4a4f22 (diff)
downloademacs-bb6e8cee927dfdc3545aabc6a23eb4d6c5f3268b.tar.gz
(toplevel): Include <signal.h> and "syssignal.h".
(vox_configure, vox_close) [SIGIO]: Block/unblock SIGIO around ioctls.
-rw-r--r--src/ChangeLog6
-rw-r--r--src/sound.c24
2 files changed, 29 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index da8913ea9ed..67be01f753b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2001-07-09 Gerd Moellmann <gerd@gnu.org>
+
+ * sound.c (toplevel): Include <signal.h> and "syssignal.h".
+ (vox_configure, vox_close) [SIGIO]: Block/unblock SIGIO
+ around ioctls.
+
2001-07-06 Eli Zaretskii <eliz@is.elta.co.il>
* dosfns.c (syms_of_dosfns): Add \n\ at the end of a line in the
diff --git a/src/sound.c b/src/sound.c
index 62d6cfb170b..e5c80059656 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -32,6 +32,8 @@ Boston, MA 02111-1307, USA. */
#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 @@ vox_configure (sd)
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 @@ vox_configure (sd)
}
turn_on_atimers (1);
+#ifdef SIGIO
+ sigunblock (sigmask (SIGIO));
+#endif
}
@@ -807,10 +818,21 @@ vox_close (sd)
{
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);