summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/thread.c b/thread.c
index 33d649b389..a0a3472b26 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;
+ }
}
}