1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* thread.c (thread_cleanup_func): Don't touch native threading

resource at fork. Sadly this is purely bandaid. We need to
          implement proper fix later. [Bug #4169] [ruby-core:33767]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kosaki 2010-12-20 15:16:41 +00:00
parent 7503f19346
commit 97da02b2a6
2 changed files with 18 additions and 3 deletions

View file

@ -1,3 +1,9 @@
Tue Dec 21 00:46:20 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* thread.c (thread_cleanup_func): Don't touch native threading
resource at fork. Sadly this is purely bandaid. We need to
implement proper fix later. [Bug #4169] [ruby-core:33767]
Tue Dec 21 00:22:44 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* error.c (exit_success_p): Check status code more carefully.

View file

@ -391,12 +391,21 @@ thread_cleanup_func_before_exec(void *th_ptr)
}
static void
thread_cleanup_func(void *th_ptr)
thread_cleanup_func(void *th_ptr, int atfork)
{
rb_thread_t *th = th_ptr;
th->locking_mutex = Qfalse;
thread_cleanup_func_before_exec(th_ptr);
/*
* Unfortunately, we can't release native threading resource at fork
* because libc may have unstable locking state therefore touching
* a threading resource may cause a deadlock.
*/
if (atfork)
return;
native_thread_destroy(th);
}
@ -525,7 +534,7 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s
ruby_cleanup(state);
}
else {
thread_cleanup_func(th);
thread_cleanup_func(th, FALSE);
gvl_release(th->vm);
}
@ -2780,7 +2789,7 @@ terminate_atfork_i(st_data_t key, st_data_t val, st_data_t current_th)
rb_mutex_abandon_all(th->keeping_mutexes);
}
th->keeping_mutexes = NULL;
thread_cleanup_func(th);
thread_cleanup_func(th, TRUE);
}
return ST_CONTINUE;
}