add dedicated stopAll()

should not change abi
This commit is contained in:
Green Sky
2025-04-11 20:46:50 +02:00
parent e25ee67e42
commit d03d2dae67
4 changed files with 27 additions and 9 deletions

View File

@ -108,6 +108,8 @@ Plugin::Plugin(Plugin&& other) {
_fn_render = other._fn_render;
other._fn_render = nullptr;
_running = other._running;
}
// unloads the plugin
@ -122,14 +124,22 @@ Plugin::~Plugin(void) {
}
// runs the start function
uint32_t Plugin::start(SolanaAPI* solana_api) const {
uint32_t Plugin::start(SolanaAPI* solana_api) {
assert(valid_plugin);
if (_running) {
return 1;
}
_running = true;
return reinterpret_cast<decltype(&solana_plugin_start)>(_fn_start)(solana_api);
}
// stop function
void Plugin::stop(void) const {
void Plugin::stop(void) {
assert(valid_plugin);
if (!_running) {
return;
}
_running = false;
reinterpret_cast<decltype(&solana_plugin_stop)>(_fn_stop)();
}