summaryrefslogtreecommitdiff
path: root/src/sound.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2014-03-25 07:43:26 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2014-03-25 07:43:26 -0700
commit1e952f0a7a1d0cc533438dcad37db08d8af6855f (patch)
tree423d42b20476efd08fa7c0e4b62756c1b09c8cdd /src/sound.c
parent1edb4a2ec657c305880901e78317daf1990b5358 (diff)
downloademacs-1e952f0a7a1d0cc533438dcad37db08d8af6855f.tar.gz
Handle sigmask better with nested signal handlers.
* atimer.c (sigmask_atimers): Remove. Remaining use rewritten to use body of this function. * atimer.c (block_atimers, unblock_atimers): * callproc.c (block_child_signal, unblock_child_signal): * sysdep.c (block_tty_out_signal, unblock_tty_out_signal): New arg OLDSET. All callers changed. * atimer.c (block_atimers, unblock_atimers): * callproc.c (block_child_signal, unblock_child_signal): * keyboard.c (handle_interrupt): * sound.c (vox_configure, vox_close): Restore the old signal mask rather than unilaterally clearing bits from the mask, in case a handler is running within another handler. All callers changed. * lisp.h, process.c, process.h, term.c: Adjust decls and callers to match new API. * sysdep.c (emacs_sigaction_init): Don't worry about masking SIGFPE; signal handlers aren't supposed to use floating point anyway. (handle_arith_signal): Unblock just SIGFPE rather than clearing mask. Fixes: debbugs:15561
Diffstat (limited to 'src/sound.c')
-rw-r--r--src/sound.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/sound.c b/src/sound.c
index a95678812e1..7046f4e8e32 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -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. */