diff options
author | Takashi Kokubun <[email protected]> | 2023-10-19 17:04:51 -0700 |
---|---|---|
committer | Takashi Kokubun <[email protected]> | 2023-10-19 17:06:23 -0700 |
commit | a9d7525fb420e721da38c0959dcc8980cd0cf38e (patch) | |
tree | 4fd6371d8fe0ab55bdd79ec90ad2f2d5320cc928 /cont.c | |
parent | 72f97ee06ebca8d33ca419c7b413568fca6c3b7e (diff) |
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.
Diffstat (limited to 'cont.c')
-rw-r--r-- | cont.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -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); |