summaryrefslogtreecommitdiff
path: root/signal.c
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-23 15:44:19 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-23 15:44:19 +0000
commit8687db60a65082a2e76650e918279a2048337e5a (patch)
tree6c38d03c12a95aa1aa2a7545b091fe5d750b32a5 /signal.c
parentf991d20910f0241319edf96a5dc6f2e38b93374f (diff)
* process.c (rb_f_fork): remove after_exec() which sometimes caused
two timer threads started. [ruby-core:25217] * signal.c: use pthread_sigmask() instead of sigprocmask(). sigprocmask() is unspecified behavior on multi-thread programs. [ruby-core:25217] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'signal.c')
-rw-r--r--signal.c31
1 files changed, 5 insertions, 26 deletions
diff --git a/signal.c b/signal.c
index 3fe16337f0..92e5d35bdc 100644
--- a/signal.c
+++ b/signal.c
@@ -888,11 +888,7 @@ static VALUE
trap_ensure(struct trap_arg *arg)
{
/* enable interrupt */
-#ifdef HAVE_SIGPROCMASK
- sigprocmask(SIG_SETMASK, &arg->mask, NULL);
-#else
- sigsetmask(arg->mask);
-#endif
+ pthread_sigmask(SIG_SETMASK, &arg->mask, NULL);
trap_last_mask = arg->mask;
return 0;
}
@@ -902,11 +898,7 @@ void
rb_trap_restore_mask(void)
{
#if USE_TRAP_MASK
-# ifdef HAVE_SIGPROCMASK
- sigprocmask(SIG_SETMASK, &trap_last_mask, NULL);
-# else
- sigsetmask(trap_last_mask);
-# endif
+ pthread_sigmask(SIG_SETMASK, &trap_last_mask, NULL);
#endif
}
@@ -966,12 +958,8 @@ sig_trap(int argc, VALUE *argv)
}
#if USE_TRAP_MASK
/* disable interrupt */
-# ifdef HAVE_SIGPROCMASK
sigfillset(&arg.mask);
- sigprocmask(SIG_BLOCK, &arg.mask, &arg.mask);
-# else
- arg.mask = sigblock(~0);
-# endif
+ pthread_sigmask(SIG_BLOCK, &arg.mask, &arg.mask);
return rb_ensure(trap, (VALUE)&arg, trap_ensure, (VALUE)&arg);
#else
@@ -1026,12 +1014,8 @@ init_sigchld(int sig)
#if USE_TRAP_MASK
/* disable interrupt */
-# ifdef HAVE_SIGPROCMASK
sigfillset(&mask);
- sigprocmask(SIG_BLOCK, &mask, &mask);
-# else
- mask = sigblock(~0);
-# endif
+ pthread_sigmask(SIG_BLOCK, &mask, &mask);
#endif
oldfunc = ruby_signal(sig, SIG_DFL);
@@ -1042,13 +1026,8 @@ init_sigchld(int sig)
}
#if USE_TRAP_MASK
-#ifdef HAVE_SIGPROCMASK
sigdelset(&mask, sig);
- sigprocmask(SIG_SETMASK, &mask, NULL);
-#else
- mask &= ~sigmask(sig);
- sigsetmask(mask);
-#endif
+ pthread_sigmask(SIG_SETMASK, &mask, NULL);
trap_last_mask = mask;
#endif
}