Index: eval_intern.h =================================================================== --- eval_intern.h (revision 32019) +++ eval_intern.h (working copy) @@ -212,7 +212,6 @@ void rb_thread_terminate_all(void); VALUE rb_vm_top_self(); VALUE rb_vm_cbase(void); -void rb_trap_restore_mask(void); #ifndef CharNext /* defined as CharNext[AW] on Windows. */ #define CharNext(p) ((p) + mblen((p), RUBY_MBCHAR_MAXSIZE)) Index: thread_pthread.c =================================================================== --- thread_pthread.c (revision 32019) +++ thread_pthread.c (working copy) @@ -1029,8 +1029,6 @@ static void rb_thread_create_timer_thread(void) { - rb_enable_interrupt(); - if (!timer_thread_id) { pthread_attr_t attr; int err; @@ -1051,7 +1049,6 @@ native_cond_wait(&timer_thread_cond, &timer_thread_lock); native_mutex_unlock(&timer_thread_lock); } - rb_disable_interrupt(); /* only timer thread recieve signal */ } static int Index: vm_core.h =================================================================== --- vm_core.h (revision 32019) +++ vm_core.h (working copy) @@ -640,8 +640,6 @@ #endif VALUE rb_iseq_eval(VALUE iseqval); VALUE rb_iseq_eval_main(VALUE iseqval); -void rb_enable_interrupt(void); -void rb_disable_interrupt(void); #if defined __GNUC__ && __GNUC__ >= 4 #pragma GCC visibility pop #endif Index: vm_eval.c =================================================================== --- vm_eval.c (revision 32019) +++ vm_eval.c (working copy) @@ -1442,7 +1442,6 @@ RB_GC_GUARD(desc); rb_raise(rb_eArgError, "uncaught throw %s", RSTRING_PTR(desc)); } - rb_trap_restore_mask(); th->errinfo = NEW_THROW_OBJECT(tag, 0, TAG_THROW); JUMP_TAG(TAG_THROW); Index: eval.c =================================================================== --- eval.c (revision 32019) +++ eval.c (working copy) @@ -439,8 +439,6 @@ JUMP_TAG(TAG_FATAL); } - rb_trap_restore_mask(); - if (tag != TAG_FATAL) { EXEC_EVENT_HOOK(th, RUBY_EVENT_RAISE, th->cfp->self, 0, 0); } Index: process.c =================================================================== --- process.c (revision 32019) +++ process.c (working copy) @@ -990,12 +990,6 @@ static void before_exec(void) { - /* - * signalmask is inherited across exec() and almost system commands don't - * work if signalmask is blocked. - */ - rb_enable_interrupt(); - #ifdef SIGPIPE /* * Some OS commands don't initialize signal handler properly. Thus we have @@ -1026,7 +1020,6 @@ #endif forked_child = 0; - rb_disable_interrupt(); } #define before_fork() before_exec() @@ -2947,43 +2940,13 @@ void rb_syswait(rb_pid_t pid) { - static int overriding; -#ifdef SIGHUP - RETSIGTYPE (*hfunc)(int) = 0; -#endif -#ifdef SIGQUIT - RETSIGTYPE (*qfunc)(int) = 0; -#endif - RETSIGTYPE (*ifunc)(int) = 0; int status; - int i, hooked = FALSE; + int err; - if (!overriding) { -#ifdef SIGHUP - hfunc = signal(SIGHUP, SIG_IGN); -#endif -#ifdef SIGQUIT - qfunc = signal(SIGQUIT, SIG_IGN); -#endif - ifunc = signal(SIGINT, SIG_IGN); - overriding = TRUE; - hooked = TRUE; - } - do { - i = rb_waitpid(pid, &status, 0); - } while (i == -1 && errno == EINTR); + err = rb_waitpid(pid, &status, 0); + } while (err == -1 && errno == EINTR); - if (hooked) { -#ifdef SIGHUP - signal(SIGHUP, hfunc); -#endif -#ifdef SIGQUIT - signal(SIGQUIT, qfunc); -#endif - signal(SIGINT, ifunc); - overriding = FALSE; - } } static VALUE Index: signal.c =================================================================== --- signal.c (revision 32019) +++ signal.c (working copy) @@ -517,31 +517,21 @@ return signal_buff.size; } -#if USE_TRAP_MASK -# ifdef HAVE_SIGPROCMASK -static sigset_t trap_last_mask; -# else -static int trap_last_mask; -# endif -#endif - #if HAVE_PTHREAD_H #include #endif -void +static void rb_disable_interrupt(void) { #if USE_TRAP_MASK sigset_t mask; sigfillset(&mask); - sigdelset(&mask, SIGVTALRM); - sigdelset(&mask, SIGSEGV); pthread_sigmask(SIG_SETMASK, &mask, NULL); #endif } -void +static void rb_enable_interrupt(void) { #if USE_TRAP_MASK @@ -867,19 +857,10 @@ { /* enable interrupt */ pthread_sigmask(SIG_SETMASK, &arg->mask, NULL); - trap_last_mask = arg->mask; return 0; } #endif -void -rb_trap_restore_mask(void) -{ -#if USE_TRAP_MASK - pthread_sigmask(SIG_SETMASK, &trap_last_mask, NULL); -#endif -} - /* * call-seq: * Signal.trap( signal, command ) -> obj @@ -986,34 +967,13 @@ init_sigchld(int sig) { sighandler_t oldfunc; -#if USE_TRAP_MASK -# ifdef HAVE_SIGPROCMASK - sigset_t mask; - sigset_t fullmask; -# else - int mask; - int fullmask; -# endif -#endif -#if USE_TRAP_MASK - /* disable interrupt */ - sigfillset(&fullmask); - pthread_sigmask(SIG_BLOCK, &fullmask, &mask); -#endif - 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; } - -#if USE_TRAP_MASK - sigdelset(&mask, sig); - pthread_sigmask(SIG_SETMASK, &mask, NULL); - trap_last_mask = mask; -#endif } #endif