Project

General

Profile

0001-signal.c-avoid-repeatedly-disable-enable-interrupt-a.patch

normalperson (Eric Wong), 01/03/2014 07:26 AM

View differences:

signal.c
1081 1081
{
1082 1082
    sighandler_t old;
1083 1083

  
1084
    /* At this time, there is no subthread. Then sigmask guarantee atomics. */
1085
    rb_disable_interrupt();
1086 1084
    old = ruby_signal(signum, handler);
1087 1085
    /* signal handler should be inherited during exec. */
1088 1086
    if (old != SIG_DFL) {
1089 1087
	ruby_signal(signum, old);
1090 1088
    }
1091
    rb_enable_interrupt();
1092 1089
}
1093 1090

  
1094 1091
#if defined(SIGCLD) || defined(SIGCHLD)
......
1097 1094
{
1098 1095
    sighandler_t oldfunc;
1099 1096

  
1100
    rb_disable_interrupt();
1101 1097
    oldfunc = ruby_signal(sig, SIG_DFL);
1102 1098
    if (oldfunc != SIG_DFL && oldfunc != SIG_IGN) {
1103 1099
	ruby_signal(sig, oldfunc);
1104 1100
    } else {
1105 1101
	GET_VM()->trap_list[sig].cmd = 0;
1106 1102
    }
1107
    rb_enable_interrupt();
1108 1103
}
1109 1104
#endif
1110 1105

  
......
1177 1172
    rb_alias(rb_eSignal, rb_intern("signm"), rb_intern("message"));
1178 1173
    rb_define_method(rb_eInterrupt, "initialize", interrupt_init, -1);
1179 1174

  
1175
    /* At this time, there is no subthread. Then sigmask guarantee atomics. */
1176
    rb_disable_interrupt();
1177

  
1180 1178
    install_sighandler(SIGINT, sighandler);
1181 1179
#ifdef SIGHUP
1182 1180
    install_sighandler(SIGHUP, sighandler);
......
1217 1215
#elif defined(SIGCHLD)
1218 1216
    init_sigchld(SIGCHLD);
1219 1217
#endif
1218

  
1219
    rb_enable_interrupt();
1220 1220
}
1221
-