summaryrefslogtreecommitdiffstats
path: root/thread.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-17 07:24:03 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-17 07:24:03 +0000
commit0dfdf0dd9f0ed7bdebbc006dd76bb7fdd22b1207 (patch)
treeff3ca5ce3ebab048ad224febd7d4ced5bb724b03 /thread.c
parentc1aec85d88cee9583f3dbe1607eb420209f97321 (diff)
downloadruby-0dfdf0dd9f0ed7bdebbc006dd76bb7fdd22b1207.tar.gz
ruby-0dfdf0dd9f0ed7bdebbc006dd76bb7fdd22b1207.tar.xz
ruby-0dfdf0dd9f0ed7bdebbc006dd76bb7fdd22b1207.zip
* thread.c (rb_thread_terminate_all): fix to ignore
exceptions. * thread.c (thread_start_func_2): fix abort_on_exception process. [ruby-dev:31394] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/thread.c b/thread.c
index bae2fd755..69f3b29e9 100644
--- a/thread.c
+++ b/thread.c
@@ -259,7 +259,14 @@ rb_thread_terminate_all(void)
st_foreach(vm->living_threads, terminate_i, (st_data_t)th);
while (!rb_thread_alone()) {
- rb_thread_schedule();
+ PUSH_TAG();
+ if (EXEC_TAG() == 0) {
+ rb_thread_schedule();
+ }
+ else {
+ /* ignore exception */
+ }
+ POP_TAG();
}
system_working = 0;
}
@@ -327,14 +334,20 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s
}
th->value = Qnil;
}
- TH_POP_TAG();
th->status = THREAD_KILLED;
thread_debug("thread end: %p\n", th);
- st_delete_wrap(th->vm->living_threads, th->self);
main_th = th->vm->main_thread;
- if (th == main_th) errinfo = Qnil;
+ if (th != main_th) {
+ if (TYPE(errinfo) == T_OBJECT) {
+ /* treat with normal error object */
+ rb_thread_raise(1, &errinfo, main_th);
+ }
+ }
+ TH_POP_TAG();
+
+ st_delete_wrap(th->vm->living_threads, th->self);
/* wake up joinning threads */
join_th = th->join_list_head;
@@ -348,11 +361,6 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s
thread_cleanup_func(th);
native_mutex_unlock(&th->vm->global_interpreter_lock);
- if (!NIL_P(errinfo)) {
- /* exit on main_thread */
- rb_thread_raise(1, &errinfo, main_th);
- }
-
return 0;
}