summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authoryangwei <[email protected]>2024-10-18 15:02:36 +0800
committeryangwei <[email protected]>2024-10-18 16:25:39 +0800
commita7b79a0e227eb509699d0a864129e5013eff50fe (patch)
tree6469ecc90ca9b047c67bce13840c3e9930092910 /include
parent722ae7483b516692141f44c8ce1ce4d3a172b056 (diff)
✨ feat(module manager): add thread_init and thread_exit API
Diffstat (limited to 'include')
-rw-r--r--include/stellar/module_manager.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/include/stellar/module_manager.h b/include/stellar/module_manager.h
index 47e8384..8caf702 100644
--- a/include/stellar/module_manager.h
+++ b/include/stellar/module_manager.h
@@ -20,21 +20,25 @@ void stellar_module_set_name(struct stellar_module* mod, const char *name);
struct stellar_module_manager;
-typedef struct stellar_module *module_on_init_func(struct stellar_module_manager *mod_mgr);
-typedef void module_on_exit_func(struct stellar_module_manager *mod_mgr, struct stellar_module *mod);
+typedef struct stellar_module *module_on_instance_init_func(struct stellar_module_manager *mod_mgr);
+typedef void module_on_instance_exit_func(struct stellar_module_manager *mod_mgr, struct stellar_module *mod);
+
+typedef struct stellar_module *module_on_thread_init_func(struct stellar_module_manager *mod_mgr, int thread_id, struct stellar_module *mod);
+typedef void module_on_thread_exit_func(struct stellar_module_manager *mod_mgr, int thread_id, struct stellar_module *mod);
struct stellar_module_manager *stellar_module_manager_new(const char *module_spec_toml_path, int max_thread_num, struct mq_schema *mq_schema, struct logger *logger);
void stellar_module_manager_free(struct stellar_module_manager *mod_mgr);
-void stellar_module_manager_register_thread(struct stellar_module_manager* mod_mgr, int thread_id, struct mq_runtime *mq_rt);
+void stellar_module_manager_register_thread(struct stellar_module_manager *mod_mgr, int thread_id, struct mq_runtime *mq_rt);
+void stellar_module_manager_unregister_thread(struct stellar_module_manager *mod_mgr, int thread_id);
// return -1 on error
-int stellar_module_manager_get_thread_id(struct stellar_module_manager* mod_mgr);
+int stellar_module_manager_get_thread_id(struct stellar_module_manager *mod_mgr);
struct mq_runtime *stellar_module_manager_get_mq_runtime(struct stellar_module_manager *mod_mgr);
struct stellar_module *stellar_module_manager_get_module(struct stellar_module_manager *mod_mgr, const char *module_name);
-int stellar_module_manager_get_max_thread_num(struct stellar_module_manager* mod_mgr);
+int stellar_module_manager_get_max_thread_num(struct stellar_module_manager *mod_mgr);
const char *stellar_module_manager_get_toml_path(struct stellar_module_manager *mod_mgr);
struct mq_schema *stellar_module_manager_get_mq_schema(struct stellar_module_manager *mod_mgr);
struct logger *stellar_module_manager_get_logger(struct stellar_module_manager *mod_mgr);