X-Git-Url: https://git.octo.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fdaemon%2Fplugin.c;h=1deabba3dde599a3c203258e1b26200519d6951c;hb=7bfda8d327240ac73297e4449663814dd0594be5;hp=e723af075d112363ac9db07d4cdab99546bfad85;hpb=dc2eb041159b967838a2eb658cb256bc846c5264;p=collectd.git diff --git a/src/daemon/plugin.c b/src/daemon/plugin.c index e723af07..1deabba3 100644 --- a/src/daemon/plugin.c +++ b/src/daemon/plugin.c @@ -1850,10 +1850,10 @@ void plugin_shutdown_all (void) { 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; @@ -1861,6 +1861,10 @@ void plugin_shutdown_all (void) 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); @@ -1890,8 +1894,6 @@ void plugin_shutdown_all (void) 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