Skip to content

Commit

Permalink
* thread.c (thread_unlock_all_locking_mutexes): rename to
Browse files Browse the repository at this point in the history
  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 ruby#4988] [ruby-dev:44049]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
kosaki committed Jul 8, 2011
1 parent 4ad2d02 commit 8741274
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
10 changes: 10 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
Fri Jul 8 13:36:02 2011 KOSAKI Motohiro <[email protected]>

* 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 <[email protected]>

* cont.c (FIBER_MACHINE_STACK_ALLOCATION_SIZE): Fiber stack size
Expand Down
3 changes: 3 additions & 0 deletions eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions vm_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
Expand Down

0 comments on commit 8741274

Please sign in to comment.