summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-27 03:04:36 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-27 03:04:36 +0000
commit2f9ee7af47124113bc0aa0966816720c907a9c91 (patch)
tree47dad32950ef86ecf965e667a94eb29fe70bb48d /thread.c
parent9ace5c122e9ad5203e98590adfc3896464b67ec1 (diff)
* thread.c (rb_thread_terminate_all): broadcast terminate event
not only an interrupt exception but any exceptions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/thread.c b/thread.c
index c9471717e0..33d649b389 100644
--- a/thread.c
+++ b/thread.c
@@ -378,28 +378,19 @@ rb_thread_terminate_all(void)
/* 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);
-
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);
- PUSH_TAG();
- if ((state = EXEC_TAG()) == 0) {
- th = GET_THREAD();
+ TH_PUSH_TAG(th);
+ if ((state = TH_EXEC_TAG()) == 0) {
native_sleep(th, 0);
RUBY_VM_CHECK_INTS_BLOCKING(th);
}
- POP_TAG();
-
- /* broadcast eTerminateSignal again if Ctrl-C was pressed. */
- if (state && rb_obj_is_kind_of(GET_THREAD()->errinfo, rb_eInterrupt)) {
- goto retry;
- }
+ TH_POP_TAG();
}
}