[前][次][番号順一覧][スレッド一覧]

ruby-changes:33831

From: nobu <ko1@a...>
Date: Sun, 11 May 2014 01:10:57 +0900 (JST)
Subject: [ruby-changes:33831] nobu:r45912 (trunk): thread.c: always deliver signal immediately

nobu	2014-05-11 01:10:45 +0900 (Sun, 11 May 2014)

  New Revision: 45912

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45912

  Log:
    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]

  Modified files:
    trunk/thread.c
Index: thread.c
===================================================================
--- thread.c	(revision 45911)
+++ thread.c	(revision 45912)
@@ -5176,13 +5176,12 @@ ruby_kill(rb_pid_t pid, int sig) https://github.com/ruby/ruby/blob/trunk/thread.c#L5176
 {
     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) https://github.com/ruby/ruby/blob/trunk/thread.c#L5189
 	native_mutex_unlock(&th->interrupt_lock);
 	GVL_UNLOCK_END();
     }
-    else {
-	err = kill(pid, sig);
-    }
-    if (err < 0)
+    if (err < 0) {
 	rb_sys_fail(0);
+    }
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]