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

ruby-changes:25818

From: kosaki <ko1@a...>
Date: Tue, 27 Nov 2012 08:09:42 +0900 (JST)
Subject: [ruby-changes:25818] kosaki:r37875 (trunk): * thread.c (rb_thread_terminate_all): broadcast eTerminateSignal

kosaki	2012-11-27 08:08:36 +0900 (Tue, 27 Nov 2012)

  New Revision: 37875

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

  Log:
    * thread.c (rb_thread_terminate_all): broadcast eTerminateSignal
      again when Ctrl-C was pressed. [Feature #1952] [ruby-dev:39107]

  Modified files:
    trunk/ChangeLog
    trunk/thread.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37874)
+++ ChangeLog	(revision 37875)
@@ -1,3 +1,8 @@
+Tue Nov 27 08:04:26 2012  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* thread.c (rb_thread_terminate_all): broadcast eTerminateSignal
+	  again when Ctrl-C was pressed. [Feature #1952] [ruby-dev:39107]
+
 Tue Nov 27 07:58:03 2012  Koichi Sasada  <ko1@a...>
 
 	* vm_core.h: add members to rb_trace_arg_t:
Index: thread.c
===================================================================
--- thread.c	(revision 37874)
+++ thread.c	(revision 37875)
@@ -378,20 +378,27 @@
     /* unlock all locking mutexes */
     rb_threadptr_unlock_all_locking_mutexes(th);
 
+
+    vm->inhibit_thread_creation = 1;
+
+  retry:
     thread_debug("rb_thread_terminate_all (main thread: %p)\n", (void *)th);
     st_foreach(vm->living_threads, terminate_i, (st_data_t)th);
-    vm->inhibit_thread_creation = 1;
 
     while (!rb_thread_alone()) {
+	int state;
+
 	PUSH_TAG();
-	if (EXEC_TAG() == 0) {
+	if ((state = EXEC_TAG()) == 0) {
 	    native_sleep(th, 0);
 	    RUBY_VM_CHECK_INTS_BLOCKING(th);
 	}
-	else {
-	    /* ignore exception */
+	POP_TAG();
+
+	/* broadcast eTerminateSignal again if Ctrl-C was pressed. */
+	if (state && rb_obj_is_kind_of(GET_THREAD()->errinfo, rb_eInterrupt)) {
+	    goto retry;
 	}
-	POP_TAG();
     }
 }
 

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

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