diff --git a/ChangeLog b/ChangeLog index 162e38e5f5..f780c1190f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Fri Nov 30 22:52:54 2007 Yukihiro Matsumoto + + * signal.c (trap_signm): SIGVTALRM no longer used for green + thread. [ruby-talk:281318] + + * signal.c (ruby_sig_finalize): do not install SIG_DFL handler if + previous handler is sighandler(). + Fri Nov 30 21:02:15 2007 NARUSE, Yui * lib/json.rb, lib/json/add/{core.rb, rails.rb}, diff --git a/eval.c b/eval.c index 27da2b2104..17371a8d5f 100644 --- a/eval.c +++ b/eval.c @@ -143,7 +143,7 @@ ruby_finalize_0(void) static void ruby_finalize_1(void) { - signal(SIGINT, SIG_DFL); + ruby_sig_finalize(); GET_THREAD()->errinfo = Qnil; rb_gc_call_finalizer_at_exit(); } diff --git a/include/ruby/intern.h b/include/ruby/intern.h index 20ba6ef55b..b8c43b2717 100644 --- a/include/ruby/intern.h +++ b/include/ruby/intern.h @@ -474,6 +474,7 @@ void rb_gc_mark_trap_list(void); #define posix_signal ruby_posix_signal void posix_signal(int, RETSIGTYPE (*)(int)); #endif +void ruby_sig_finalize(void); void rb_trap_exit(void); void rb_trap_exec(void); const char *ruby_signal_name(int); diff --git a/signal.c b/signal.c index bd2579dd0a..6eba832e5d 100644 --- a/signal.c +++ b/signal.c @@ -783,12 +783,6 @@ trap_signm(VALUE vsig) if (sig == 0 && strcmp(s, "EXIT") != 0) rb_raise(rb_eArgError, "unsupported signal SIG%s", s); } - -#if defined(HAVE_SETITIMER) - if (sig == SIGVTALRM) { - rb_raise(rb_eArgError, "SIGVTALRM reserved for Thread; can't set handler"); - } -#endif return sig; } @@ -993,6 +987,18 @@ init_sigchld(int sig) #endif } +void +ruby_sig_finalize() +{ + sighandler_t oldfunc; + + oldfunc = ruby_signal(SIGINT, SIG_IGN); + if (oldfunc == sighandler) { + ruby_signal(SIGINT, SIG_DFL); + } +} + + #ifdef RUBY_DEBUG_ENV int ruby_enable_coredump = 0; #endif