diff --git a/ChangeLog b/ChangeLog index 39dde79fdd..33506eddd0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Fri Jul 8 13:36:02 2011 KOSAKI Motohiro + + * thread.c (thread_unlock_all_locking_mutexes): rename to + rb_threadptr_unlock_all_locking_mutexes and remove static. + * vm_core.h: add rb_threadptr_unlock_all_locking_mutexes declaration. + * thread.c (thread_start_func_2): adjust the above rename. + + * eval.c (ruby_cleanup): call rb_threadptr_unlock_all_locking_mutexes + again after finalizer. [Bug #4988] [ruby-dev:44049] + Fri Jul 8 13:06:09 2011 KOSAKI Motohiro * cont.c (FIBER_MACHINE_STACK_ALLOCATION_SIZE): Fiber stack size diff --git a/eval.c b/eval.c index feb543d461..783335d9d9 100644 --- a/eval.c +++ b/eval.c @@ -145,6 +145,9 @@ ruby_cleanup(volatile int ex) th->errinfo = errs[1]; ex = error_handle(ex); ruby_finalize_1(); + + /* unlock again if finalizer took mutexes. */ + rb_threadptr_unlock_all_locking_mutexes(GET_THREAD()); POP_TAG(); rb_thread_stop_timer_thread(1); diff --git a/thread.c b/thread.c index 3ef587b33f..b412dd5fee 100644 --- a/thread.c +++ b/thread.c @@ -365,8 +365,8 @@ rb_thread_terminate_all(void) } } -static void -thread_unlock_all_locking_mutexes(rb_thread_t *th) +void +rb_threadptr_unlock_all_locking_mutexes(rb_thread_t *th) { if (th->keeping_mutexes) { rb_mutex_unlock_all(th->keeping_mutexes, th); @@ -517,7 +517,7 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s join_th = join_th->join_list_next; } - thread_unlock_all_locking_mutexes(th); + rb_threadptr_unlock_all_locking_mutexes(th); if (th != main_th) rb_check_deadlock(th->vm); if (!th->root_fiber) { diff --git a/vm_core.h b/vm_core.h index 27961287b0..cc450c5790 100644 --- a/vm_core.h +++ b/vm_core.h @@ -702,6 +702,7 @@ void rb_threadptr_signal_raise(rb_thread_t *th, int sig); void rb_threadptr_signal_exit(rb_thread_t *th); void rb_threadptr_execute_interrupts(rb_thread_t *); void rb_threadptr_interrupt(rb_thread_t *th); +void rb_threadptr_unlock_all_locking_mutexes(rb_thread_t *th); void rb_thread_lock_unlock(rb_thread_lock_t *); void rb_thread_lock_destroy(rb_thread_lock_t *);