X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=include%2Fecoli_init.h;h=39938f787454d27480b44d252c1792ec8605c92f;hb=376f5016e3979247bf0db515e47df49ba1eb82ac;hp=4e8bc1e5e11219a9039f17b01ab1363efa703154;hpb=18d03456d96f7a086a2ccc82ce97fcf056848d90;p=protos%2Flibecoli.git diff --git a/include/ecoli_init.h b/include/ecoli_init.h index 4e8bc1e..39938f7 100644 --- a/include/ecoli_init.h +++ b/include/ecoli_init.h @@ -3,7 +3,10 @@ */ /** - * Register initialization routines. + * @defgroup nodes Nodes + * @{ + * + * @brief Register initialization routines. */ #ifndef ECOLI_INIT_ @@ -14,6 +17,11 @@ #include #include +/** + * Register initialization and exit callbacks. These callbacks are + * ordered by priority: for initialization, the lowest priority is called + * first. For exit, the callbacks are invoked in reverse order. + */ #define EC_INIT_REGISTER(t) \ static void ec_init_init_##t(void); \ static void __attribute__((constructor, used)) \ @@ -27,6 +35,11 @@ */ typedef int (ec_init_t)(void); +/** + * Type of exit function. + */ +typedef void (ec_exit_t)(void); + TAILQ_HEAD(ec_init_list, ec_init); /** @@ -35,6 +48,7 @@ TAILQ_HEAD(ec_init_list, ec_init); struct ec_init { TAILQ_ENTRY(ec_init) next; /**< Next in list. */ ec_init_t *init; /**< Init function. */ + ec_exit_t *exit; /**< Exit function. */ unsigned int priority; /**< Priority (0=first, 99=last) */ }; @@ -47,7 +61,7 @@ struct ec_init { void ec_init_register(struct ec_init *test); /** - * Initialize ecoli library + * Initialize ecoli library. * * Must be called before any other function from libecoli, except * ec_malloc_register(). @@ -57,4 +71,11 @@ void ec_init_register(struct ec_init *test); */ int ec_init(void); +/** + * Uninitialize ecoli library. + */ +void ec_exit(void); + #endif + +/** @} */