From: "U.Nakamura" Date: 2009-08-20T13:22:10+09:00 Subject: [ruby-dev:39140] Re: [Bug #1952] cannot stop with Ctrl+C こんにちは、なかむら(う)です。 In message "[ruby-dev:39131] Re: [Bug #1952] cannot stop with Ctrl+C" on Aug.19,2009 17:49:23, wrote: > > * kill -9を必要とするのは問題である。ので、main threadは割 > > り込み可能にしておくべき > > とりあえずこれですね。 > ちなみに、thread.c:320の/* ignore exception */のところになり > ます。 パッチは用意してみましたが、そもそもなぜここでは例外を無視し ていたのでしょう?>ささださん 普通に考えると、ここで起きうる例外って自身に対する割り込みだ けのような気がするんですが... Index: thread.c =================================================================== --- thread.c (revision 24567) +++ thread.c (working copy) @@ -298,6 +298,7 @@ rb_thread_terminate_all(void) { rb_thread_t *th = GET_THREAD(); /* main thread */ rb_vm_t *vm = th->vm; + int state; if (vm->main_thread != th) { rb_bug("rb_thread_terminate_all: called by child thread (%p, %p)", (void *)vm->main_thread, (void *)th); @@ -311,14 +312,12 @@ rb_thread_terminate_all(void) 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()) { + state = 0; + while (state == 0 && !rb_thread_alone()) { PUSH_TAG(); - if (EXEC_TAG() == 0) { + if ((state = EXEC_TAG()) == 0) { rb_thread_schedule(); } - else { - /* ignore exception */ - } POP_TAG(); } rb_thread_stop_timer_thread(); それでは。 -- U.Nakamura