summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2025-03-25 14:34:41 -0700
committerJohn Hawthorn <john@hawthorn.email>2025-03-25 19:14:26 -0700
commit310c00a1371ccbf584b7aaa4c1768a68c3813f58 (patch)
treeeb78aec009ad026b77a118320a51b3650c5203ba /thread.c
parentbe6954f5d466f4b274505e4f14bcad291d0b0989 (diff)
Reset thread interrupt lock on fork
If a thread was holding this lock before fork, it will not exist in the child process. We should re-initialize these locks as we do with the VM locks when forking. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12981
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/thread.c b/thread.c
index 359671ba9e..2efb237f58 100644
--- a/thread.c
+++ b/thread.c
@@ -4756,6 +4756,7 @@ static void
terminate_atfork_i(rb_thread_t *th, const rb_thread_t *current_th)
{
if (th != current_th) {
+ rb_native_mutex_initialize(&th->interrupt_lock);
rb_mutex_abandon_keeping_mutexes(th);
rb_mutex_abandon_locking_mutex(th);
thread_cleanup_func(th, TRUE);