From 1f0304218cf00e05a4a126196676ba221ebf91f6 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Wed, 20 Dec 2023 15:29:03 -0800 Subject: [PATCH] Use main_thread->ec from rb_vm_main_ractor_ec rb_vm_main_ractor_ec was introduced to allow rb_postponed_job_* to work when fired on non-Ruby threads, which have no EC set, and that is its only use. When RUBY_MN_THREADS=1 is set ractor->threads.running_ec is NULL when the shared thread is sleeping. This instead grabs the EC directly from the main thread which seems to always be set. Fixes [Bug #20016] Co-authored-by: Dustin Brown --- ractor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ractor.c b/ractor.c index 8362f2f332e0b2..f07dd7c8e53fb9 100644 --- a/ractor.c +++ b/ractor.c @@ -2481,7 +2481,7 @@ rb_ractor_terminate_all(void) rb_execution_context_t * rb_vm_main_ractor_ec(rb_vm_t *vm) { - return vm->ractor.main_ractor->threads.running_ec; + return vm->ractor.main_thread->ec; } static VALUE