Feature #9346 ยป 0001-signal.c-avoid-repeatedly-disable-enable-interrupt-a.patch
signal.c | ||
---|---|---|
{
|
||
sighandler_t old;
|
||
/* At this time, there is no subthread. Then sigmask guarantee atomics. */
|
||
rb_disable_interrupt();
|
||
old = ruby_signal(signum, handler);
|
||
/* signal handler should be inherited during exec. */
|
||
if (old != SIG_DFL) {
|
||
ruby_signal(signum, old);
|
||
}
|
||
rb_enable_interrupt();
|
||
}
|
||
#if defined(SIGCLD) || defined(SIGCHLD)
|
||
... | ... | |
{
|
||
sighandler_t oldfunc;
|
||
rb_disable_interrupt();
|
||
oldfunc = ruby_signal(sig, SIG_DFL);
|
||
if (oldfunc != SIG_DFL && oldfunc != SIG_IGN) {
|
||
ruby_signal(sig, oldfunc);
|
||
} else {
|
||
GET_VM()->trap_list[sig].cmd = 0;
|
||
}
|
||
rb_enable_interrupt();
|
||
}
|
||
#endif
|
||
... | ... | |
rb_alias(rb_eSignal, rb_intern("signm"), rb_intern("message"));
|
||
rb_define_method(rb_eInterrupt, "initialize", interrupt_init, -1);
|
||
/* At this time, there is no subthread. Then sigmask guarantee atomics. */
|
||
rb_disable_interrupt();
|
||
install_sighandler(SIGINT, sighandler);
|
||
#ifdef SIGHUP
|
||
install_sighandler(SIGHUP, sighandler);
|
||
... | ... | |
#elif defined(SIGCHLD)
|
||
init_sigchld(SIGCHLD);
|
||
#endif
|
||
rb_enable_interrupt();
|
||
}
|