diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-10 16:10:45 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-10 16:10:45 +0000 |
commit | 3771a370ad64aae87f751751e80d52d02a1735a9 (patch) | |
tree | a2f958bb88b72847d30950bce15b9535e166e210 | |
parent | 77af38d0a5bd759bc332b817485212614ace7f1c (diff) | |
download | ruby-3771a370ad64aae87f751751e80d52d02a1735a9.tar.gz |
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
-rw-r--r-- | thread.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -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); + } } |