зеркало из https://github.com/github/ruby.git
Avoid initializing jit_cont_lock multiple times
Contrary to my initial assumption, rb_threadptr_root_fiber_setup() is called for each Ractor, not just once at boot. I changed the place to call rb_jit_cont_init() to avoid calling it multiple times.
This commit is contained in:
Родитель
72f97ee06e
Коммит
a9d7525fb4
5
cont.c
5
cont.c
|
@ -2552,9 +2552,6 @@ rb_threadptr_root_fiber_setup(rb_thread_t *th)
|
|||
fiber->killed = 0;
|
||||
fiber_status_set(fiber, FIBER_RESUMED); /* skip CREATED */
|
||||
th->ec = &fiber->cont.saved_ec;
|
||||
// This is the first fiber. Hence it's the first jit_cont_new() as well.
|
||||
// Initialize the mutex for jit_cont_new() in cont_init_jit_cont().
|
||||
rb_jit_cont_init();
|
||||
cont_init_jit_cont(&fiber->cont);
|
||||
}
|
||||
|
||||
|
@ -3446,6 +3443,8 @@ Init_Cont(void)
|
|||
}
|
||||
}
|
||||
|
||||
rb_jit_cont_init();
|
||||
|
||||
rb_cFiber = rb_define_class("Fiber", rb_cObject);
|
||||
rb_define_alloc_func(rb_cFiber, fiber_alloc);
|
||||
rb_eFiberError = rb_define_class("FiberError", rb_eStandardError);
|
||||
|
|
Загрузка…
Ссылка в новой задаче