summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuta Saito <kateinoigakukun@gmail.com>2026-05-12 09:00:02 +0100
committerYuta Saito <kateinoigakukun@gmail.com>2026-05-12 13:38:35 +0100
commit0fa6cb88f5e238e819cd663b1edc80db59a74b2a (patch)
tree6b02a7a87f92f9cfc7b7f8735d9ff8be6842d620
parent2f9432d2114833b105577ad72e323990daf5101e (diff)
[Bug #21989] Fix FiberError init order to precede all possible usage
The `FiberError` class can be used in `fiber_pool_initialize` through `fiber_pool_expand` but `FiberError` was defined after `fiber_pool_initialize` in `Init_Cont`. This commit moves the definition of `FiberError` before `fiber_pool_initialize` to ensure that `FiberError` is defined before any possible usage.
-rw-r--r--cont.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/cont.c b/cont.c
index c44d233a9f..6bb61e5ee8 100644
--- a/cont.c
+++ b/cont.c
@@ -3651,6 +3651,8 @@ Init_Cont(void)
#endif
SET_MACHINE_STACK_END(&th->ec->machine.stack_end);
+ rb_eFiberError = rb_define_class("FiberError", rb_eStandardError);
+
size_t minimum_count = shared_fiber_pool_minimum_count();
size_t maximum_count = shared_fiber_pool_maximum_count();
fiber_pool_initialize(&shared_fiber_pool, stack_size, minimum_count, maximum_count, vm_stack_size);
@@ -3675,7 +3677,6 @@ Init_Cont(void)
rb_cFiber = rb_define_class("Fiber", rb_cObject);
rb_define_alloc_func(rb_cFiber, fiber_alloc);
- rb_eFiberError = rb_define_class("FiberError", rb_eStandardError);
rb_define_singleton_method(rb_cFiber, "yield", rb_fiber_s_yield, -1);
rb_define_singleton_method(rb_cFiber, "current", rb_fiber_s_current, 0);
rb_define_singleton_method(rb_cFiber, "blocking", rb_fiber_blocking, 0);