summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-27 03:18:29 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-27 03:18:29 +0000
commitc72f0daa877808e4fa5018b3191ca09d4b97c03d (patch)
tree7ac7d777e99ecf92d6882f284dd92f5b77198231
parent2f9ee7af47124113bc0aa0966816720c907a9c91 (diff)
* thread.c (rb_thread_terminate_all): retry broadcast only when
an exception is raised. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--thread.c10
2 files changed, 13 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index b8bf4e2..8c76752 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Nov 27 12:17:11 2012 Koichi Sasada <ko1@atdot.net>
+
+ * thread.c (rb_thread_terminate_all): retry broadcast only when
+ an exception is raised.
+
Tue Nov 27 12:02:25 2012 Koichi Sasada <ko1@atdot.net>
* thread.c (rb_thread_terminate_all): broadcast terminate event
diff --git a/thread.c b/thread.c
index 33d649b..a0a3472 100644
--- a/thread.c
+++ b/thread.c
@@ -380,10 +380,12 @@ rb_thread_terminate_all(void)
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 @@ rb_thread_terminate_all(void)
RUBY_VM_CHECK_INTS_BLOCKING(th);
}
TH_POP_TAG();
+
+ if (state) {
+ goto retry;
+ }
}
}