1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
mame 2010-04-23 15:44:19 +00:00
parent f991d20910
commit 8687db60a6
3 changed files with 14 additions and 29 deletions

View file

@ -1,3 +1,12 @@
Sat Apr 24 00:41:52 2010 Yusuke Endoh <mame@tsg.ne.jp>
* 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]
Sat Apr 24 00:36:05 2010 Yusuke Endoh <mame@tsg.ne.jp>
* test/dl/test_base.rb: add kfreebsd support. based on a patch from

View file

@ -2620,9 +2620,6 @@ rb_f_fork(VALUE obj)
switch (pid = rb_fork(0, 0, 0, Qnil)) {
case 0:
#ifdef linux
after_exec();
#endif
rb_thread_atfork();
if (rb_block_given_p()) {
int status;

View file

@ -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
}