mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Add fixed state atexit stack feature.
Adds following macros: * MRB_FIXED_STATE_ATEXIT_STACK (not defined by default) * When defined enables fixed state atexit stack. * MRB_FIXED_STATE_ATEXIT_STACK_SIZE (default value: 5) * This macro will be ignored when `MRB_FIXED_STATE_ATEXIT_STACK` isn't defined. * When `mrb_state_atexit` is called more than this value it will raise runtime error.
This commit is contained in:
@@ -52,6 +52,10 @@ typedef void* (*mrb_allocf) (struct mrb_state *mrb, void*, size_t, void *ud);
|
||||
#define MRB_GC_ARENA_SIZE 100
|
||||
#endif
|
||||
|
||||
#ifndef MRB_FIXED_STATE_ATEXIT_STACK_SIZE
|
||||
#define MRB_FIXED_STATE_ATEXIT_STACK_SIZE 5
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
mrb_sym mid;
|
||||
struct RProc *proc;
|
||||
@@ -173,7 +177,11 @@ typedef struct mrb_state {
|
||||
|
||||
void *ud; /* auxiliary data */
|
||||
|
||||
#ifdef MRB_FIXED_STATE_ATEXIT_STACK
|
||||
mrb_atexit_func atexit_stack[MRB_FIXED_STATE_ATEXIT_STACK_SIZE];
|
||||
#else
|
||||
mrb_atexit_func *atexit_stack;
|
||||
#endif
|
||||
mrb_int atexit_stack_len;
|
||||
} mrb_state;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user