summaryrefslogtreecommitdiffhomepage
path: root/include/mruby.h
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-06-05 13:22:28 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-06-05 13:22:28 +0900
commita763d1149062347377c696074f5f8cf2d813c814 (patch)
tree82cf60a137141136c085c704f53e54cddc0a0786 /include/mruby.h
parentcbbed40295d8ed7cbf51f0e5bd0b7747a9b2c295 (diff)
parent64300b2c43e040ae2cd63bd0ef72a10a54db6631 (diff)
downloadmruby-a763d1149062347377c696074f5f8cf2d813c814.tar.gz
mruby-a763d1149062347377c696074f5f8cf2d813c814.zip
Merge branch 'atexit' of https://github.com/take-cheeze/mruby into take-cheeze-atexit
Diffstat (limited to 'include/mruby.h')
-rw-r--r--include/mruby.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/mruby.h b/include/mruby.h
index e2054f440..04ef018cb 100644
--- a/include/mruby.h
+++ b/include/mruby.h
@@ -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;
@@ -170,6 +172,9 @@ typedef struct mrb_state {
struct RObject *nomem_err; /* pre-allocated NoMemoryError */
void *ud; /* auxiliary data */
+
+ mrb_atexit_func *atexit_stack;
+ mrb_int atexit_stack_len;
} mrb_state;
#if __STDC_VERSION__ >= 201112L
@@ -414,6 +419,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)