summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index bbf66b3152..e54b5400c8 100644
--- a/eval.c
+++ b/eval.c
@@ -129,6 +129,9 @@ ruby_cleanup(volatile int ex)
int nerr;
void rb_threadptr_interrupt(rb_thread_t *th);
void rb_threadptr_check_signal(rb_thread_t *mth);
+ int i;
+ rb_vm_t *vm = GET_VM();
+ VALUE ary = (VALUE)&vm->at_exit;
rb_threadptr_interrupt(th);
rb_threadptr_check_signal(th);
@@ -148,6 +151,13 @@ ruby_cleanup(volatile int ex)
}
POP_TAG();
+ /* at_exit functions called here; any other place more apropriate
+ * for this purpose? let me know if any. */
+ for (i=0; i<RARRAY_LEN(ary); i++) {
+ ((void(*)(rb_vm_t*))RARRAY_PTR(ary)[i])(vm);
+ }
+ rb_ary_clear(ary);
+
errs[0] = th->errinfo;
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {