summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authorJohn Hawthorn <[email protected]>2024-08-08 02:10:15 -0700
committerJohn Hawthorn <[email protected]>2024-08-13 11:52:24 -0700
commit87a85550edd786665e081b355c6af62c4854b1d7 (patch)
tree81b94db34a4716b8b1d4a6aed6b54b6d3f7b0ff5 /thread_pthread.c
parent908305a2977856264a932cad02437c30f08c365b (diff)
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 <[email protected]>
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11356
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c1
1 files changed, 1 insertions, 0 deletions
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);