From 3771a370ad64aae87f751751e80d52d02a1735a9 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 10 May 2014 16:10:45 +0000 Subject: [PATCH] thread.c: always deliver signal immediately * thread.c (ruby_kill): always deliver signal immediately, without check for main thread. no longer called in other context. [ruby-dev:48203] [Bug #9820] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/thread.c b/thread.c index 61cf3a1a03..a011de1991 100644 --- a/thread.c +++ b/thread.c @@ -5176,13 +5176,12 @@ ruby_kill(rb_pid_t pid, int sig) { int err; rb_thread_t *th = GET_THREAD(); - rb_vm_t *vm = GET_VM(); /* * When target pid is self, many caller assume signal will be * delivered immediately and synchronously. */ - if ((sig != 0) && (th == vm->main_thread) && (pid == getpid())) { + { GVL_UNLOCK_BEGIN(); native_mutex_lock(&th->interrupt_lock); err = kill(pid, sig); @@ -5190,9 +5189,7 @@ ruby_kill(rb_pid_t pid, int sig) native_mutex_unlock(&th->interrupt_lock); GVL_UNLOCK_END(); } - else { - err = kill(pid, sig); - } - if (err < 0) + if (err < 0) { rb_sys_fail(0); + } }