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

ruby-changes:12859

From: matz <ko1@a...>
Date: Thu, 20 Aug 2009 09:42:38 +0900 (JST)
Subject: [ruby-changes:12859] Ruby:r24591 (trunk): * thread.c (rb_thread_terminate_all): do not ignore interrupt when

matz	2009-08-20 09:42:16 +0900 (Thu, 20 Aug 2009)

  New Revision: 24591

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

  Log:
    * thread.c (rb_thread_terminate_all): do not ignore interrupt when
      reaping threads on termination.  [ruby-dev:39107]

  Modified files:
    trunk/ChangeLog
    trunk/thread.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 24590)
+++ ChangeLog	(revision 24591)
@@ -1,3 +1,8 @@
+Thu Aug 20 08:39:50 2009  Yukihiro Matsumoto  <matz@r...>
+
+	* thread.c (rb_thread_terminate_all): do not ignore interrupt when
+	  reaping threads on termination.  [ruby-dev:39107]
+
 Thu Aug 20 02:32:08 2009  Tanaka Akira  <akr@f...>
 
 	* enumerator.c (next_init): don't clear feedvalue.
Index: thread.c
===================================================================
--- thread.c	(revision 24590)
+++ thread.c	(revision 24591)
@@ -298,6 +298,9 @@
 {
     rb_thread_t *th = GET_THREAD(); /* main thread */
     rb_vm_t *vm = th->vm;
+    VALUE einfo = vm->main_thread->errinfo;
+    int state;
+
     if (vm->main_thread != th) {
 	rb_bug("rb_thread_terminate_all: called by child thread (%p, %p)",
 	       (void *)vm->main_thread, (void *)th);
@@ -313,13 +316,14 @@
 
     while (!rb_thread_alone()) {
 	PUSH_TAG();
-	if (EXEC_TAG() == 0) {
+	if ((state = EXEC_TAG()) == 0) {
 	    rb_thread_schedule();
 	}
-	else {
-	    /* ignore exception */
+	POP_TAG();
+	if (state && einfo != vm->main_thread->errinfo &&
+	    RUBY_VM_SET_INTERRUPT(vm->main_thread)) {
+	    break;
 	}
-	POP_TAG();
     }
     rb_thread_stop_timer_thread();
 }

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

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