diff --git a/src/daemon/plugin.c b/src/daemon/plugin.c
index e7d4e8df2c801b7e6d0a0e6a8bdd4e120cedbf20..a8e6ca1312a61c92ff352740fe8f0873d287ecb5 100644 (file)
--- a/src/daemon/plugin.c
+++ b/src/daemon/plugin.c
return (status);
}
-static void plugin_free_loaded ()
+static void plugin_free_loaded (void)
{
void *key;
void *value;
void plugin_init_all (void)
{
char const *chain_name;
- long write_threads_num;
llentry_t *le;
int status;
{
llentry_t *le;
- stop_read_threads ();
-
destroy_all_callbacks (&list_init);
+ stop_read_threads ();
+
pthread_mutex_lock (&read_lock);
llist_destroy (read_list);
read_list = NULL;
destroy_read_heap ();
+ /* blocks until all write threads have shut down. */
+ stop_write_threads ();
+
+ /* ask all plugins to write out the state they kept. */
plugin_flush (/* plugin = */ NULL,
/* timeout = */ 0,
/* identifier = */ NULL);
plugin_set_ctx (old_ctx);
}
- stop_write_threads ();
-
/* Write plugins which use the `user_data' pointer usually need the
* same data available to the flush callback. If this is the case, set
* the free_function to NULL when registering the flush callback and to
case DS_TYPE_GAUGE:
vl->values[0].gauge = va_arg (ap, gauge_t);
if (store_percentage)
- vl->values[0].gauge *= 100.0 / sum;
+ vl->values[0].gauge *= sum ? (100.0 / sum) : NAN;
break;
case DS_TYPE_ABSOLUTE:
vl->values[0].absolute = va_arg (ap, absolute_t);