mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Add API mrb_atexit().
`mrb_final_mrbgems` will be called as mrb_state atexit function. Maybe useful in #1844.
This commit is contained in:
@@ -102,6 +102,8 @@ enum gc_state {
|
||||
|
||||
struct mrb_jmpbuf;
|
||||
|
||||
typedef void (*mrb_atexit_func)(struct mrb_state*);
|
||||
|
||||
typedef struct mrb_state {
|
||||
struct mrb_jmpbuf *jmp;
|
||||
|
||||
@@ -169,6 +171,9 @@ typedef struct mrb_state {
|
||||
struct RClass *eStandardError_class;
|
||||
|
||||
void *ud; /* auxiliary data */
|
||||
|
||||
mrb_atexit_func *atexit_stack;
|
||||
mrb_int atexit_stack_len;
|
||||
} mrb_state;
|
||||
|
||||
#if __STDC_VERSION__ >= 201112L
|
||||
@@ -413,6 +418,8 @@ void* mrb_pool_realloc(struct mrb_pool*, void*, size_t oldlen, size_t newlen);
|
||||
mrb_bool mrb_pool_can_realloc(struct mrb_pool*, void*, size_t);
|
||||
void* mrb_alloca(mrb_state *mrb, size_t);
|
||||
|
||||
void mrb_atexit(mrb_state *mrb, mrb_atexit_func func);
|
||||
|
||||
#ifdef MRB_DEBUG
|
||||
#include <assert.h>
|
||||
#define mrb_assert(p) assert(p)
|
||||
|
||||
Reference in New Issue
Block a user