summaryrefslogtreecommitdiff
path: root/vm_core.h
diff options
context:
space:
mode:
Diffstat (limited to 'vm_core.h')
-rw-r--r--vm_core.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/vm_core.h b/vm_core.h
index 5ddd7b4b4f..6b975ac3ef 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -1799,11 +1799,18 @@ rb_current_thread(void)
return rb_ec_thread_ptr(ec);
}
+extern struct rb_ractor_struct *ruby_single_main_ractor; // ractor.c
+
static inline rb_ractor_t *
rb_current_ractor(void)
{
- const rb_execution_context_t *ec = GET_EC();
- return rb_ec_ractor_ptr(ec);
+ if (ruby_single_main_ractor) {
+ return ruby_single_main_ractor;
+ }
+ else {
+ const rb_execution_context_t *ec = GET_EC();
+ return rb_ec_ractor_ptr(ec);
+ }
}
static inline rb_vm_t *