Mercurial > hg > octave-max
changeset 2016:6f3428b0d2c7
[project @ 1996-03-22 09:48:38 by jwe]
author | jwe |
---|---|
date | Fri, 22 Mar 1996 09:49:03 +0000 |
parents | 9e4e71b27b3a |
children | 1d831915c580 |
files | src/sighandlers.cc src/sighandlers.h src/toplev.cc |
diffstat | 3 files changed, 36 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/sighandlers.cc +++ b/src/sighandlers.cc @@ -48,6 +48,34 @@ // Nonzero means we can be interrupted. int can_interrupt = 0; +// Allow us to save the signal mask and then restore it to the most +// recently saved value. This is necessary when using the POSIX +// signal handling interface on some systems calling longjmp out of +// the signal handler to get to the top level on an interrupt doesn't +// restore the original signal mask. Alternatively, we could use +// sigsetjmp/siglongjmp, but saving and restoring the signal mask +// ourselves works ok and seems simpler just now. + +#if defined (HAVE_POSIX_SIGNALS) +static sigset_t octave_signal_mask; +#endif + +void +octave_save_signal_mask (void) +{ +#if defined (HAVE_POSIX_SIGNALS) + sigprocmask (0, 0, &octave_signal_mask); +#endif +} + +void +octave_restore_signal_mask (void) +{ +#if defined (HAVE_POSIX_SIGNALS) + sigprocmask (SIG_SETMASK, &octave_signal_mask, 0); +#endif +} + static void my_friendly_exit (const char *sig_name, int sig_number) {