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

ruby-changes:25247

From: ko1 <ko1@a...>
Date: Tue, 23 Oct 2012 22:38:07 +0900 (JST)
Subject: [ruby-changes:25247] ko1:r37299 (trunk): * thread.c (thread_raise_m): check interrupts after Thread#raise

ko1	2012-10-23 22:37:45 +0900 (Tue, 23 Oct 2012)

  New Revision: 37299

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

  Log:
    * thread.c (thread_raise_m):  check interrupts after Thread#raise
      if a target thread is the current thread because the behavior
      of Thread.current.raise is expected to perform same as
      Kernel.raise (by rubyspec).

  Modified files:
    trunk/ChangeLog
    trunk/thread.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37298)
+++ ChangeLog	(revision 37299)
@@ -1,3 +1,10 @@
+Tue Oct 23 22:34:49 2012  Koichi Sasada  <ko1@a...>
+
+	* thread.c (thread_raise_m):  check interrupts after Thread#raise
+	  if a target thread is the current thread because the behavior
+	  of Thread.current.raise is expected to perform same as
+	  Kernel.raise (by rubyspec).
+
 Tue Oct 23 17:08:39 2012  Nobuyoshi Nakada  <nobu@r...>
 
 	* ruby.c (usage, process_options): show more info in --help.
Index: thread.c
===================================================================
--- thread.c	(revision 37298)
+++ thread.c	(revision 37299)
@@ -1894,9 +1894,15 @@
 static VALUE
 thread_raise_m(int argc, VALUE *argv, VALUE self)
 {
-    rb_thread_t *th;
-    GetThreadPtr(self, th);
-    rb_threadptr_raise(th, argc, argv);
+    rb_thread_t *target_th;
+    rb_thread_t *th = GET_THREAD();
+    GetThreadPtr(self, target_th);
+    rb_threadptr_raise(target_th, argc, argv);
+
+    /* To perform Thread.current.raise as Kernel.raise */
+    if (th == target_th) {
+	RUBY_VM_CHECK_INTS(th);
+    }
     return Qnil;
 }
 

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

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