diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | eval.c | 3 | ||||
-rw-r--r-- | thread.c | 6 | ||||
-rw-r--r-- | vm_core.h | 1 |
4 files changed, 17 insertions, 3 deletions
@@ -1,3 +1,13 @@ +Fri Jul 8 13:36:02 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com> + + * 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 <kosaki.motohiro@gmail.com> * cont.c (FIBER_MACHINE_STACK_ALLOCATION_SIZE): Fiber stack size @@ -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); @@ -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) { @@ -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 *); |