1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2014-05-10 16:10:45 +00:00
parent 77af38d0a5
commit 3771a370ad

View file

@ -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);
}
}