ruby-changes:25831
From: ko1 <ko1@a...>
Date: Tue, 27 Nov 2012 12:18:40 +0900 (JST)
Subject: [ruby-changes:25831] ko1:r37888 (trunk): * thread.c (rb_thread_terminate_all): retry broadcast only when
ko1 2012-11-27 12:18:29 +0900 (Tue, 27 Nov 2012) New Revision: 37888 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37888 Log: * thread.c (rb_thread_terminate_all): retry broadcast only when an exception is raised. Modified files: trunk/ChangeLog trunk/thread.c Index: ChangeLog =================================================================== --- ChangeLog (revision 37887) +++ ChangeLog (revision 37888) @@ -1,3 +1,8 @@ +Tue Nov 27 12:17:11 2012 Koichi Sasada <ko1@a...> + + * thread.c (rb_thread_terminate_all): retry broadcast only when + an exception is raised. + Tue Nov 27 12:02:25 2012 Koichi Sasada <ko1@a...> * thread.c (rb_thread_terminate_all): broadcast terminate event Index: thread.c =================================================================== --- thread.c (revision 37887) +++ thread.c (revision 37888) @@ -380,10 +380,12 @@ 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); + while (!rb_thread_alone()) { int state; - thread_debug("rb_thread_terminate_all (main thread: %p)\n", (void *)th); - st_foreach(vm->living_threads, terminate_i, (st_data_t)th); TH_PUSH_TAG(th); if ((state = TH_EXEC_TAG()) == 0) { @@ -391,6 +393,10 @@ RUBY_VM_CHECK_INTS_BLOCKING(th); } TH_POP_TAG(); + + if (state) { + goto retry; + } } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/