summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1b3e368)
raw | patch | inline | side by side (parent: 1b3e368)
author | Sebastian Harl <sh@tokkee.org> | |
Wed, 2 Jul 2008 14:26:46 +0000 (16:26 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Sun, 6 Jul 2008 12:27:18 +0000 (14:27 +0200) |
plugin_init_all() checks if any read callbacks are available before starting
the read threads. A few plugins register their read callback from their
init callback though. By initializing the plugins before that the read
threads are still started correctly if all plugins register the read
callback in the init callback.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
the read threads. A few plugins register their read callback from their
init callback though. By initializing the plugins before that the read
threads are still started correctly if all plugins register the read
callback in the init callback.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
src/plugin.c | patch | blob | history |
diff --git a/src/plugin.c b/src/plugin.c
index 8b2803dfa49b345b95d4da9f586740e6105af69a..f1333f1d43ce8fa8a347d8fc0e112479615f1563 100644 (file)
--- a/src/plugin.c
+++ b/src/plugin.c
llentry_t *le;
int status;
- /* Start read-threads */
- if (list_read != NULL)
- {
- const char *rt;
- int num;
- rt = global_option_get ("ReadThreads");
- num = atoi (rt);
- start_threads ((num > 0) ? num : 5);
- }
-
/* Init the value cache */
uc_init ();
- if (list_init == NULL)
+ if ((list_init == NULL) && (list_read == NULL))
return;
+ /* Calling all init callbacks before checking if read callbacks
+ * are available allows the init callbacks to register the read
+ * callback. */
le = llist_head (list_init);
while (le != NULL)
{
"failed with status %i. "
"Plugin will be unloaded.",
le->key, status);
+ /* Plugins that register read callbacks from the init
+ * callback should take care of appropriate error
+ * handling themselves. */
/* FIXME: Unload _all_ functions */
plugin_unregister_read (le->key);
}
le = le->next;
}
+
+ /* Start read-threads */
+ if (list_read != NULL)
+ {
+ const char *rt;
+ int num;
+ rt = global_option_get ("ReadThreads");
+ num = atoi (rt);
+ start_threads ((num > 0) ? num : 5);
+ }
} /* void plugin_init_all */
void plugin_read_all (void)