From 87a85550edd786665e081b355c6af62c4854b1d7 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Thu, 8 Aug 2024 02:10:15 -0700 Subject: Re-initialize vm->ractor.sched.lock after fork Previously under certain conditions it was possible to encounter a deadlock in the forked child process if ractor.sched.lock was held. Co-authored-by: Nathan Froyd --- thread_pthread.c | 1 + 1 file changed, 1 insertion(+) (limited to 'thread_pthread.c') diff --git a/thread_pthread.c b/thread_pthread.c index a4363aec48..3ebb67aaa3 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -1556,6 +1556,7 @@ thread_sched_atfork(struct rb_thread_sched *sched) } vm->ractor.sched.running_cnt = 0; + rb_native_mutex_initialize(&vm->ractor.sched.lock); // rb_native_cond_destroy(&vm->ractor.sched.cond); rb_native_cond_initialize(&vm->ractor.sched.cond); rb_native_cond_initialize(&vm->ractor.sched.barrier_complete_cond); -- cgit v1.2.3