summaryrefslogtreecommitdiff
path: root/signal.c
diff options
context:
space:
mode:
Diffstat (limited to 'signal.c')
-rw-r--r--signal.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/signal.c b/signal.c
index e5621b4ec1..f518d597e0 100644
--- a/signal.c
+++ b/signal.c
@@ -358,6 +358,12 @@ struct trap_arg {
VALUE sig, cmd;
};
+# ifdef HAVE_SIGPROCMASK
+static sigset_t trap_last_mask;
+# else
+static int trap_last_mask;
+# endif
+
static RETSIGTYPE
sigexit()
{
@@ -476,9 +482,22 @@ trap_ensure(arg)
#else
sigsetmask(arg->mask);
#endif
+ trap_last_mask = arg->mask;
}
#endif
+void
+trap_restore_mask()
+{
+#ifndef NT
+# ifdef HAVE_SIGPROCMASK
+ sigprocmask(SIG_SETMASK, &trap_last_mask, NULL);
+# else
+ sigsetmask(trap_last_mask);
+# endif
+#endif
+}
+
static VALUE
f_trap(argc, argv)
int argc;