summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2024-08-14 10:19:53 -0700
committerGitHub <noreply@github.com>2024-08-14 10:19:53 -0700
commit66312ad913d67bfd3c2c83b174eabf537f5def84 (patch)
tree6fb26eba9b74471ab4c75ecf5653661ad724412f /thread_pthread.c
parent4d11a0960d1b9c88c4e85bfeffb83c5f08f7099b (diff)
Re-initialize vm->ractor.sched.lock after fork (#11372)
[Bug #20633] 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 <froydnj@gmail.com>
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 82a255d030..305cbdbec1 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -1530,6 +1530,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);