* 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().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2007-11-30 14:08:58 +00:00
Родитель 897b452f8d
Коммит 29c7c72e09
4 изменённых файлов: 22 добавлений и 7 удалений

Просмотреть файл

@ -1,3 +1,11 @@
Fri Nov 30 22:52:54 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* 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 <naruse@ruby-lang.org> Fri Nov 30 21:02:15 2007 NARUSE, Yui <naruse@ruby-lang.org>
* lib/json.rb, lib/json/add/{core.rb, rails.rb}, * lib/json.rb, lib/json/add/{core.rb, rails.rb},

2
eval.c
Просмотреть файл

@ -143,7 +143,7 @@ ruby_finalize_0(void)
static void static void
ruby_finalize_1(void) ruby_finalize_1(void)
{ {
signal(SIGINT, SIG_DFL); ruby_sig_finalize();
GET_THREAD()->errinfo = Qnil; GET_THREAD()->errinfo = Qnil;
rb_gc_call_finalizer_at_exit(); rb_gc_call_finalizer_at_exit();
} }

Просмотреть файл

@ -474,6 +474,7 @@ void rb_gc_mark_trap_list(void);
#define posix_signal ruby_posix_signal #define posix_signal ruby_posix_signal
void posix_signal(int, RETSIGTYPE (*)(int)); void posix_signal(int, RETSIGTYPE (*)(int));
#endif #endif
void ruby_sig_finalize(void);
void rb_trap_exit(void); void rb_trap_exit(void);
void rb_trap_exec(void); void rb_trap_exec(void);
const char *ruby_signal_name(int); const char *ruby_signal_name(int);

Просмотреть файл

@ -783,12 +783,6 @@ trap_signm(VALUE vsig)
if (sig == 0 && strcmp(s, "EXIT") != 0) if (sig == 0 && strcmp(s, "EXIT") != 0)
rb_raise(rb_eArgError, "unsupported signal SIG%s", s); 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; return sig;
} }
@ -993,6 +987,18 @@ init_sigchld(int sig)
#endif #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 #ifdef RUBY_DEBUG_ENV
int ruby_enable_coredump = 0; int ruby_enable_coredump = 0;
#endif #endif