summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-26 23:08:36 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-26 23:08:36 +0000
commita916278900dcd0db090db11d50e082e941968b9f (patch)
tree6ecf8f49429ff4fd61d1b1ec9c491cc85b07d080 /thread.c
parent8c138db3d28828365f86f276ec753a248d2e0a19 (diff)
* thread.c (rb_thread_terminate_all): broadcast eTerminateSignal
again when Ctrl-C was pressed. [Feature #1952] [ruby-dev:39107] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/thread.c b/thread.c
index ed8d429ef8..e74cf6d14a 100644
--- a/thread.c
+++ b/thread.c
@@ -378,20 +378,27 @@ 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);
- 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;
+ }
}
}