mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 04:55:21 +02:00
thread.c: fix deadlock
* thread.c (ruby_kill): get rid of deadlock on signal 0. [ruby-dev:47182] [Bug #8137] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
042594bb50
commit
5de144f3a5
3 changed files with 15 additions and 3 deletions
5
thread.c
5
thread.c
|
@ -5214,14 +5214,15 @@ ruby_kill(rb_pid_t pid, int sig)
|
|||
* When target pid is self, many caller assume signal will be
|
||||
* delivered immediately and synchronously.
|
||||
*/
|
||||
if ((th == vm->main_thread) && (pid == getpid())) {
|
||||
if ((sig != 0) && (th == vm->main_thread) && (pid == getpid())) {
|
||||
GVL_UNLOCK_BEGIN();
|
||||
native_mutex_lock(&th->interrupt_lock);
|
||||
err = kill(pid, sig);
|
||||
native_cond_wait(&th->interrupt_cond, &th->interrupt_lock);
|
||||
native_mutex_unlock(&th->interrupt_lock);
|
||||
GVL_UNLOCK_END();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
err = kill(pid, sig);
|
||||
}
|
||||
if (err < 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue