mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* thread_pthread.c (rb_thread_create_timer_thread): removed
rb_disable_interrupt()/rb_enable_interrupt(). * vm_core.h: ditto. * process.c (static void before_exec): ditto. * process.c (static void after_exec): ditto. [Bug #4765] [ruby-dev:43571] * eval_intern.h: removed rb_trap_restore_mask(). * vm_eval.c (rb_throw_obj): ditto. * eval.c (setup_exception): ditto. * signal.c: removed trap_last_mask. * signal.c (trap_restore_mask): removed. * signal.c (init_sigchld): comment clarification why signal block is needed. and removed trap_last_mask operation. * signal.c (trap_ensure): removed trap_last_mask operation. * signal.c (rb_disable_interrupt, rb_enable_interrupt): made static and removed sigdelset(SIGVTALARM) and sigdelset(SIGSEGV). * process.c (rb_syswait): removed implicit signal handler change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0b6c9402c7
commit
74b339e938
8 changed files with 33 additions and 71 deletions
24
ChangeLog
24
ChangeLog
|
@ -1,3 +1,27 @@
|
|||
Mon Jul 11 01:16:27 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* thread_pthread.c (rb_thread_create_timer_thread): removed
|
||||
rb_disable_interrupt()/rb_enable_interrupt().
|
||||
* vm_core.h: ditto.
|
||||
* process.c (static void before_exec): ditto.
|
||||
* process.c (static void after_exec): ditto.
|
||||
[Bug #4765] [ruby-dev:43571]
|
||||
|
||||
* eval_intern.h: removed rb_trap_restore_mask().
|
||||
* vm_eval.c (rb_throw_obj): ditto.
|
||||
* eval.c (setup_exception): ditto.
|
||||
|
||||
* signal.c: removed trap_last_mask.
|
||||
* signal.c (trap_restore_mask): removed.
|
||||
* signal.c (init_sigchld): comment clarification why signal block
|
||||
is needed. and removed trap_last_mask operation.
|
||||
* signal.c (trap_ensure): removed trap_last_mask operation.
|
||||
|
||||
* signal.c (rb_disable_interrupt, rb_enable_interrupt): made
|
||||
static and removed sigdelset(SIGVTALARM) and sigdelset(SIGSEGV).
|
||||
|
||||
* process.c (rb_syswait): removed implicit signal handler change.
|
||||
|
||||
Sun Jul 10 23:49:12 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
|
||||
|
||||
* docs/NEWS-1.9.3: moved from NEWS.
|
||||
|
|
2
eval.c
2
eval.c
|
@ -430,8 +430,6 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg)
|
|||
JUMP_TAG(TAG_FATAL);
|
||||
}
|
||||
|
||||
rb_trap_restore_mask();
|
||||
|
||||
if (tag != TAG_FATAL) {
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_RAISE, th->cfp->self, 0, 0);
|
||||
}
|
||||
|
|
|
@ -213,7 +213,6 @@ void rb_vm_set_progname(VALUE filename);
|
|||
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))
|
||||
|
|
43
process.c
43
process.c
|
@ -992,12 +992,6 @@ static RETSIGTYPE sig_do_nothing(int sig)
|
|||
|
||||
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
|
||||
|
@ -1028,7 +1022,6 @@ static void after_exec(void)
|
|||
#endif
|
||||
|
||||
forked_child = 0;
|
||||
rb_disable_interrupt();
|
||||
}
|
||||
|
||||
#define before_fork() before_exec()
|
||||
|
@ -2947,43 +2940,9 @@ rb_f_abort(int argc, VALUE *argv)
|
|||
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;
|
||||
|
||||
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);
|
||||
|
||||
if (hooked) {
|
||||
#ifdef SIGHUP
|
||||
signal(SIGHUP, hfunc);
|
||||
#endif
|
||||
#ifdef SIGQUIT
|
||||
signal(SIGQUIT, qfunc);
|
||||
#endif
|
||||
signal(SIGINT, ifunc);
|
||||
overriding = FALSE;
|
||||
}
|
||||
rb_waitpid(pid, &status, 0);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
27
signal.c
27
signal.c
|
@ -519,27 +519,21 @@ rb_signal_buff_size(void)
|
|||
return signal_buff.size;
|
||||
}
|
||||
|
||||
#if USE_TRAP_MASK
|
||||
static sigset_t trap_last_mask;
|
||||
#endif
|
||||
|
||||
#if HAVE_PTHREAD_H
|
||||
#include <pthread.h>
|
||||
#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
|
||||
|
@ -872,19 +866,10 @@ trap_ensure(struct trap_arg *arg)
|
|||
{
|
||||
/* 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
|
||||
|
@ -995,7 +980,12 @@ init_sigchld(int sig)
|
|||
sigset_t mask;
|
||||
sigset_t fullmask;
|
||||
|
||||
/* disable interrupt */
|
||||
/*
|
||||
* disable interrupt. Otherwise following temmporal signal handler change
|
||||
* has a race.
|
||||
* Note: now we have only single thread, therefore both sigprocmask() and
|
||||
* pthread_sigmask() makes the same effect.
|
||||
*/
|
||||
sigfillset(&fullmask);
|
||||
pthread_sigmask(SIG_BLOCK, &fullmask, &mask);
|
||||
#endif
|
||||
|
@ -1010,7 +1000,6 @@ init_sigchld(int sig)
|
|||
#if USE_TRAP_MASK
|
||||
sigdelset(&mask, sig);
|
||||
pthread_sigmask(SIG_SETMASK, &mask, NULL);
|
||||
trap_last_mask = mask;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1159,8 +1159,6 @@ thread_timer(void *p)
|
|||
static void
|
||||
rb_thread_create_timer_thread(void)
|
||||
{
|
||||
rb_enable_interrupt();
|
||||
|
||||
if (!timer_thread_id) {
|
||||
pthread_attr_t attr;
|
||||
int err;
|
||||
|
@ -1223,8 +1221,6 @@ rb_thread_create_timer_thread(void)
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
rb_disable_interrupt(); /* only timer thread recieve signal */
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -634,8 +634,6 @@ void rb_vm_bugreport(void);
|
|||
#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
|
||||
|
|
|
@ -1441,7 +1441,6 @@ rb_throw_obj(VALUE tag, VALUE value)
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue