summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2025-03-25 15:26:55 -0700
committerJohn Hawthorn <john@hawthorn.email>2025-05-08 10:53:28 -0700
commitf7ff380998888f5bdcd6fccda472fdd3e5f40470 (patch)
tree14a108c35f6bf36bda71d3c27259f3ea2d44d897 /thread.c
parentd7ad53f249de459190d88bcb16c819411226be46 (diff)
Clean up Ractor cache after fork
Ractors created in a parent process should be properly shut down in the child process. They need their cache cleared and status set to "terminated" Co-authored-by: John Hawthorn <john@hawthorn.email>
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12982
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/thread.c b/thread.c
index d09767cb75..e56545e1c0 100644
--- a/thread.c
+++ b/thread.c
@@ -4740,6 +4740,9 @@ rb_thread_atfork_internal(rb_thread_t *th, void (*atfork)(rb_thread_t *, const r
// OK. Only this thread accesses:
ccan_list_for_each(&vm->ractor.set, r, vmlr_node) {
+ if (r != vm->ractor.main_ractor) {
+ rb_ractor_terminate_atfork(vm, r);
+ }
ccan_list_for_each(&r->threads.set, i, lt_node) {
atfork(i, th);
}