6#include "eval_intern.h"
7#include "internal/ractor.h"
12rb_call_end_proc(
VALUE data)
44 rb_raise(rb_eArgError,
"called without a block");
46 rb_ractor_ensure_main_ractor(
"can not call at_exit from non-main Ractors");
48 rb_set_end_proc(rb_call_end_proc, proc);
61rb_set_end_proc(
void (*func)(
VALUE),
VALUE data)
67 if (th->top_wrapper) {
68 list = &ephemeral_end_procs;
86 rb_gc_mark(link->data);
89 link = ephemeral_end_procs;
91 rb_gc_mark(link->data);
101 VALUE errinfo = *errp;
103 while ((link = *procs) != 0) {
107 (*endproc.func) (endproc.data);
115 enum ruby_tag_type state;
116 volatile VALUE errinfo = ec->errinfo;
118 VALUE shown_causes = 0;
119 volatile bool finished =
false;
123 if ((state = EC_EXEC_TAG()) == TAG_NONE) {
124 exec_end_procs_chain(&ephemeral_end_procs, &ec->errinfo);
125 exec_end_procs_chain(&end_procs, &ec->errinfo);
129 if (state != TAG_NONE) {
130 VALUE err = ec->errinfo;
131 add_shown_cause(errinfo, &shown_causes);
132 error_handle_with_shown_causes(ec, err, state, &shown_causes);
133 if (!
NIL_P(err)) errinfo = err;
137 ec->errinfo = errinfo;
#define rb_define_global_function(mid, func, arity)
Defines rb_mKernel #mid.
int rb_block_given_p(void)
Determines if the current method is given a block.
#define ALLOC
Old name of RB_ALLOC.
#define NIL_P
Old name of RB_NIL_P.
VALUE rb_ary_new(void)
Allocates a new, empty array.
VALUE rb_proc_call(VALUE recv, VALUE args)
Evaluates the passed proc with the passed arguments.
VALUE rb_block_proc(void)
Constructs a Proc object from implicitly passed components.
#define _(args)
This was a transition path from K&R to ANSI.
uintptr_t VALUE
Type that represents a Ruby object.