summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 924c3a5)
raw | patch | inline | side by side (parent: 924c3a5)
author | Sebastian Harl <sh@tokkee.org> | |
Tue, 22 Apr 2014 17:49:02 +0000 (19:49 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Tue, 22 Apr 2014 17:49:02 +0000 (19:49 +0200) |
This function calls all registered "shutdown" callbacks.
src/core/plugin.c | patch | blob | history | |
src/include/core/plugin.h | patch | blob | history |
diff --git a/src/core/plugin.c b/src/core/plugin.c
index a73faa04f726a3353ea788548493078279dcfb30..d1f7541a3b61824b66eecb27c6f2d29fcc3c233b 100644 (file)
--- a/src/core/plugin.c
+++ b/src/core/plugin.c
return ret;
} /* sdb_plugin_init_all */
+int
+sdb_plugin_shutdown_all(void)
+{
+ sdb_llist_iter_t *iter;
+ int ret = 0;
+
+ iter = sdb_llist_get_iter(shutdown_list);
+ while (sdb_llist_iter_has_next(iter)) {
+ sdb_plugin_cb_t *cb;
+ sdb_plugin_shutdown_cb callback;
+ ctx_t *old_ctx;
+
+ sdb_object_t *obj = sdb_llist_iter_get_next(iter);
+ assert(obj);
+ cb = SDB_PLUGIN_CB(obj);
+
+ callback = (sdb_plugin_shutdown_cb)cb->cb_callback;
+
+ old_ctx = ctx_set(cb->cb_ctx);
+ if (callback(cb->cb_user_data)) {
+ sdb_log(SDB_LOG_ERR, "core: Failed to shutdown plugin '%s'.",
+ obj->name);
+ ++ret;
+ }
+ ctx_set(old_ctx);
+ }
+ sdb_llist_iter_destroy(iter);
+ return ret;
+} /* sdb_plugin_shutdown_all */
+
int
sdb_plugin_collector_loop(sdb_plugin_loop_t *loop)
{
index 9701d603cbec0ce2a3026a84d06228627214ec5f..e5e222fe6c7ca286512e3a7d5c0ba3721ad8a1a6 100644 (file)
int
sdb_plugin_init_all(void);
+/*
+ * sdb_plugin_shutdown_all:
+ * Shutdown all plugins using their registered "shutdown" function.
+ *
+ * Returns:
+ * The number of failed shutdowns.
+ */
+int
+sdb_plugin_shutdown_all(void);
+
/*
* sdb_plugin_collector_loop:
* Loop until loop->do_loop is false, calling the next collector function on