Add basic app interface
- Add pool struct for data pools
This commit is contained in:
+14
-1
@@ -7,7 +7,20 @@ struct Block {
|
||||
mrb_value proc;
|
||||
|
||||
Block(mrb_value proc) : proc(proc) {
|
||||
mrb_gc_protect(mrb, proc);
|
||||
mrb_gc_register(mrb, proc);
|
||||
}
|
||||
|
||||
Block() : proc(mrb_nil_value()) {}
|
||||
|
||||
Block(const Block &) = delete;
|
||||
Block &operator=(const Block &) = delete;
|
||||
|
||||
mrb_value call(int argc = 0, mrb_value *argv = nullptr) const {
|
||||
return mrb_funcall(mrb, proc, "call", argc, argv);
|
||||
}
|
||||
|
||||
~Block() {
|
||||
mrb_gc_unregister(mrb, proc);
|
||||
}
|
||||
};
|
||||
}; // namespace Ruby
|
||||
Reference in New Issue
Block a user