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

thread.c: GET_THREAD once in rb_thread_atfork

* thread.c (rb_thread_atfork_internal): move th to an argument.
* thread.c (rb_thread_atfork): do not repeat GET_THREAD().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-05-09 01:52:01 +00:00
parent a46df859cc
commit 639bfd6d9c
2 changed files with 12 additions and 5 deletions

View file

@ -1,3 +1,9 @@
Mon May 9 10:51:59 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* thread.c (rb_thread_atfork_internal): move th to an argument.
* thread.c (rb_thread_atfork): do not repeat GET_THREAD().
Mon May 9 10:46:36 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* thread.c (rb_thread_atfork, rb_thread_atfork_before_exec): do

View file

@ -3942,9 +3942,8 @@ clear_coverage(void)
}
static void
rb_thread_atfork_internal(void (*atfork)(rb_thread_t *, const rb_thread_t *))
rb_thread_atfork_internal(rb_thread_t *th, void (*atfork)(rb_thread_t *, const rb_thread_t *))
{
rb_thread_t *th = GET_THREAD();
rb_thread_t *i = 0;
rb_vm_t *vm = th->vm;
vm->main_thread = th;
@ -3973,8 +3972,9 @@ terminate_atfork_i(rb_thread_t *th, const rb_thread_t *current_th)
void
rb_thread_atfork(void)
{
rb_thread_atfork_internal(terminate_atfork_i);
GET_THREAD()->join_list = NULL;
rb_thread_t *th = GET_THREAD();
rb_thread_atfork_internal(th, terminate_atfork_i);
th->join_list = NULL;
/* We don't want reproduce CVE-2003-0900. */
rb_reset_random_seed();
@ -3991,7 +3991,8 @@ terminate_atfork_before_exec_i(rb_thread_t *th, const rb_thread_t *current_th)
void
rb_thread_atfork_before_exec(void)
{
rb_thread_atfork_internal(terminate_atfork_before_exec_i);
rb_thread_t *th = GET_THREAD();
rb_thread_atfork_internal(th, terminate_atfork_before_exec_i);
}
#else
void