diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-01-19 16:01:45 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-01-19 19:57:16 +0900 |
commit | d650b17686d49c2ce8e6a87039861154e93d4621 (patch) | |
tree | d118492480903dfa666ca3c407cc0e6c9698c8aa /cont.c | |
parent | 5c7af72304d0ad33cd3f21b24a4bc44e8acd5b2c (diff) |
`rb_fiber_terminate` must not return [Bug #18497]
In a forked process from a fiber, the fiber becomes the only
fiber, `fiber_switch` does nothing as there is no other fibers,
`rb_fiber_terminate` does not terminate the fiber. In that case,
reaches the end of `fiber_entry` finaly, which is declared as
"COROUTINE" and should never return.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5468
Diffstat (limited to 'cont.c')
-rw-r--r-- | cont.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -2039,7 +2039,7 @@ rb_fiber_set_scheduler(VALUE klass, VALUE scheduler) return rb_fiber_scheduler_set(scheduler); } -static void rb_fiber_terminate(rb_fiber_t *fiber, int need_interrupt, VALUE err); +NORETURN(static void rb_fiber_terminate(rb_fiber_t *fiber, int need_interrupt, VALUE err)); void rb_fiber_start(rb_fiber_t *fiber) @@ -2408,6 +2408,7 @@ rb_fiber_terminate(rb_fiber_t *fiber, int need_interrupt, VALUE error) fiber_switch(next_fiber, -1, &error, RB_NO_KEYWORDS, NULL, false); else fiber_switch(next_fiber, 1, &value, RB_NO_KEYWORDS, NULL, false); + ruby_stop(0); } static VALUE |