🦄 refactor(module_manager ): new with hooks
This commit is contained in:
@@ -24,7 +24,7 @@ const char *module_get_name(struct module* mod);
|
||||
void module_set_name(struct module* mod, const char *name);
|
||||
|
||||
/*******************************************
|
||||
* module API *
|
||||
* module manager API *
|
||||
*******************************************/
|
||||
|
||||
struct module_manager;
|
||||
@@ -35,7 +35,7 @@ typedef void module_on_instance_exit_func(struct module_manager *mod_mgr, struct
|
||||
typedef struct module *module_on_thread_init_func(struct module_manager *mod_mgr, int thread_id, struct module *mod);
|
||||
typedef void module_on_thread_exit_func(struct module_manager *mod_mgr, int thread_id, struct module *mod);
|
||||
|
||||
struct module_specification
|
||||
struct module_hooks
|
||||
{
|
||||
module_on_instance_init_func *on_instance_init_cb;
|
||||
module_on_instance_exit_func *on_instance_exit_cb;
|
||||
@@ -43,7 +43,7 @@ struct module_specification
|
||||
module_on_thread_exit_func *on_thread_exit_cb;
|
||||
};
|
||||
|
||||
struct module_manager *module_manager_new(struct module_specification mod_specs[], size_t n_mod, int max_thread_num, struct mq_schema *mq_schema, struct logger *logger);
|
||||
struct module_manager *module_manager_new(struct module_hooks mod_specs[], size_t n_mod, int max_thread_num, const char *toml_path, struct mq_schema *mq_schema, struct logger *logger);
|
||||
void module_manager_free(struct module_manager *mod_mgr);
|
||||
|
||||
void module_manager_register_thread(struct module_manager *mod_mgr, int thread_id, struct mq_runtime *mq_rt);
|
||||
@@ -60,6 +60,10 @@ const char *module_manager_get_toml_path(struct module_manager *mod_mgr);
|
||||
struct mq_schema *module_manager_get_mq_schema(struct module_manager *mod_mgr);
|
||||
struct logger *module_manager_get_logger(struct module_manager *mod_mgr);
|
||||
|
||||
/*******************************************
|
||||
* polling API *
|
||||
*******************************************/
|
||||
|
||||
typedef void module_on_polling_func(struct module_manager *mod_mgr, void *polling_arg);
|
||||
int module_manager_polling_subscribe(struct module_manager *mod_mgr, module_on_polling_func on_polling, void *polling_arg);
|
||||
void module_manager_polling_active(struct module_manager *mod_mgr);
|
||||
|
||||
Reference in New Issue
Block a user