use dynwind_begin and dynwind_end
[bpt/emacs.git] / src / sound.c
index a956788..ad51c73 100644 (file)
@@ -702,7 +702,7 @@ vox_configure (struct sound_device *sd)
 {
   int val;
 #ifdef USABLE_SIGIO
-  sigset_t blocked;
+  sigset_t oldset, blocked;
 #endif
 
   eassert (sd->fd >= 0);
@@ -714,7 +714,7 @@ vox_configure (struct sound_device *sd)
 #ifdef USABLE_SIGIO
   sigemptyset (&blocked);
   sigaddset (&blocked, SIGIO);
-  pthread_sigmask (SIG_BLOCK, &blocked, 0);
+  pthread_sigmask (SIG_BLOCK, &blocked, &oldset);
 #endif
 
   val = sd->format;
@@ -748,7 +748,7 @@ vox_configure (struct sound_device *sd)
 
   turn_on_atimers (1);
 #ifdef USABLE_SIGIO
-  pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
+  pthread_sigmask (SIG_SETMASK, &oldset, 0);
 #endif
 }
 
@@ -764,10 +764,10 @@ vox_close (struct sound_device *sd)
         be interrupted by a signal.  Block the ones we know to cause
         troubles.  */
 #ifdef USABLE_SIGIO
-      sigset_t blocked;
+      sigset_t blocked, oldset;
       sigemptyset (&blocked);
       sigaddset (&blocked, SIGIO);
-      pthread_sigmask (SIG_BLOCK, &blocked, 0);
+      pthread_sigmask (SIG_BLOCK, &blocked, &oldset);
 #endif
       turn_on_atimers (0);
 
@@ -776,7 +776,7 @@ vox_close (struct sound_device *sd)
 
       turn_on_atimers (1);
 #ifdef USABLE_SIGIO
-      pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
+      pthread_sigmask (SIG_SETMASK, &oldset, 0);
 #endif
 
       /* Close the device.  */
@@ -1302,7 +1302,7 @@ Internal use only, use `play-sound' instead.  */)
   (Lisp_Object sound)
 {
   Lisp_Object attrs[SOUND_ATTR_SENTINEL];
-  ptrdiff_t count = SPECPDL_INDEX ();
+  dynwind_begin ();
 
 #ifndef WINDOWSNT
   Lisp_Object file;
@@ -1412,7 +1412,7 @@ Internal use only, use `play-sound' instead.  */)
 
 #endif /* WINDOWSNT */
 
-  unbind_to (count, Qnil);
+  dynwind_end ();
   return Qnil;
 }
 \f
@@ -1423,12 +1423,12 @@ Internal use only, use `play-sound' instead.  */)
 void
 syms_of_sound (void)
 {
+#include "sound.x"
+
   DEFSYM (QCdevice, ":device");
   DEFSYM (QCvolume, ":volume");
   DEFSYM (Qsound, "sound");
   DEFSYM (Qplay_sound_functions, "play-sound-functions");
-
-  defsubr (&Splay_sound_internal);
 }
 
 #endif /* HAVE_SOUND */