api documentation
[protos/libecoli.git] / include / ecoli_init.h
index 4e8bc1e..39938f7 100644 (file)
@@ -3,7 +3,10 @@
  */
 
 /**
- * Register initialization routines.
+ * @defgroup nodes Nodes
+ * @{
+ *
+ * @brief Register initialization routines.
  */
 
 #ifndef ECOLI_INIT_
 #include <ecoli_log.h>
 #include <ecoli_node.h>
 
+/**
+ * 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))                  \
  */
 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
+
+/** @} */