diff --git a/ChangeLog b/ChangeLog index a72320590c..d6f9c71575 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Sat Apr 24 00:41:52 2010 Yusuke Endoh + + * 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 * test/dl/test_base.rb: add kfreebsd support. based on a patch from diff --git a/process.c b/process.c index e566e9b753..4f68d690fb 100644 --- a/process.c +++ b/process.c @@ -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; 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 }