* 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
This commit is contained in:
parent
8c138db3d2
commit
a916278900
@ -1,3 +1,8 @@
|
|||||||
|
Tue Nov 27 08:04:26 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
|
* thread.c (rb_thread_terminate_all): broadcast eTerminateSignal
|
||||||
|
again when Ctrl-C was pressed. [Feature #1952] [ruby-dev:39107]
|
||||||
|
|
||||||
Tue Nov 27 07:58:03 2012 Koichi Sasada <ko1@atdot.net>
|
Tue Nov 27 07:58:03 2012 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* vm_core.h: add members to rb_trace_arg_t:
|
* vm_core.h: add members to rb_trace_arg_t:
|
||||||
|
19
thread.c
19
thread.c
@ -378,20 +378,27 @@ rb_thread_terminate_all(void)
|
|||||||
/* unlock all locking mutexes */
|
/* unlock all locking mutexes */
|
||||||
rb_threadptr_unlock_all_locking_mutexes(th);
|
rb_threadptr_unlock_all_locking_mutexes(th);
|
||||||
|
|
||||||
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;
|
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()) {
|
while (!rb_thread_alone()) {
|
||||||
|
int state;
|
||||||
|
|
||||||
PUSH_TAG();
|
PUSH_TAG();
|
||||||
if (EXEC_TAG() == 0) {
|
if ((state = EXEC_TAG()) == 0) {
|
||||||
native_sleep(th, 0);
|
native_sleep(th, 0);
|
||||||
RUBY_VM_CHECK_INTS_BLOCKING(th);
|
RUBY_VM_CHECK_INTS_BLOCKING(th);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
/* ignore exception */
|
|
||||||
}
|
|
||||||
POP_TAG();
|
POP_TAG();
|
||||||
|
|
||||||
|
/* broadcast eTerminateSignal again if Ctrl-C was pressed. */
|
||||||
|
if (state && rb_obj_is_kind_of(GET_THREAD()->errinfo, rb_eInterrupt)) {
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user