diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-10 15:01:14 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-10 15:01:14 +0000 |
commit | 1a7564a0ed8aa82eb3a7002906e34388b677dc58 (patch) | |
tree | 70851831075a810857882b04c7bee0fd6d9f6c0c /thread.c | |
parent | 9242da9e02fb7b37e20d6178ba6c9658d6bf8f31 (diff) | |
download | ruby-1a7564a0ed8aa82eb3a7002906e34388b677dc58.tar.gz |
* thread.c (thread_start_func_2): not re-raise to main thread if it is
joining the current thread.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r-- | thread.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -287,6 +287,7 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s VALUE args = th->first_args; rb_proc_t *proc; rb_thread_t *join_th; + rb_thread_t *main_th; VALUE errinfo = Qnil; th->machine_stack_start = stack_start; @@ -332,9 +333,13 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s 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; + /* wake up joinning threads */ join_th = th->join_list_head; while (join_th) { + if (join_th == main_th) errinfo = Qnil; rb_thread_interrupt(join_th); join_th = join_th->join_list_next; } @@ -343,9 +348,9 @@ 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) && th != th->vm->main_thread) { + if (!NIL_P(errinfo)) { /* exit on main_thread */ - rb_thread_raise(1, &errinfo, th->vm->main_thread); + rb_thread_raise(1, &errinfo, main_th); } return 0; |