diff options
Diffstat (limited to 'signal.c')
-rw-r--r-- | signal.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1298,15 +1298,12 @@ install_sighandler(int signum, sighandler_t handler) { sighandler_t old; - /* At this time, there is no subthread. Then sigmask guarantee atomics. */ - rb_disable_interrupt(); old = ruby_signal(signum, handler); if (old == SIG_ERR) return -1; /* signal handler should be inherited during exec. */ if (old != SIG_DFL) { ruby_signal(signum, old); } - rb_enable_interrupt(); return 0; } #ifndef __native_client__ @@ -1319,7 +1316,6 @@ init_sigchld(int sig) { sighandler_t oldfunc; - rb_disable_interrupt(); oldfunc = ruby_signal(sig, SIG_DFL); if (oldfunc == SIG_ERR) return -1; if (oldfunc != SIG_DFL && oldfunc != SIG_IGN) { @@ -1328,7 +1324,6 @@ init_sigchld(int sig) else { GET_VM()->trap_list[sig].cmd = 0; } - rb_enable_interrupt(); return 0; } # ifndef __native_client__ @@ -1405,6 +1400,9 @@ Init_signal(void) rb_alias(rb_eSignal, rb_intern_const("signm"), rb_intern_const("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); @@ -1448,4 +1446,6 @@ Init_signal(void) #elif defined(SIGCHLD) init_sigchld(SIGCHLD); #endif + + rb_enable_interrupt(); } |