summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-10 16:10:45 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-10 16:10:45 +0000
commit3771a370ad64aae87f751751e80d52d02a1735a9 (patch)
treea2f958bb88b72847d30950bce15b9535e166e210 /thread.c
parent77af38d0a5bd759bc332b817485212614ace7f1c (diff)
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
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c9
1 files 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);
+ }
}