summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a3000cb)
raw | patch | inline | side by side (parent: a3000cb)
author | Florian Forster <octo@collectd.org> | |
Wed, 3 Aug 2016 20:27:26 +0000 (22:27 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Wed, 3 Aug 2016 20:27:26 +0000 (22:27 +0200) |
Issue: #1110
src/network.c | patch | blob | history | |
src/plugin.c | patch | blob | history |
diff --git a/src/network.c b/src/network.c
index 71eb1f255d04c0e99a685622d4eabff629d45e90..9d33acd6a06accc964251f0af26fa8f737f1285e 100644 (file)
--- a/src/network.c
+++ b/src/network.c
{
int status;
+ /* listen_loop is set to non-zero in the shutdown callback, which is
+ * guaranteed to be called *after* all the write threads have been shut
+ * down. */
+ assert (listen_loop == 0);
+
if (!check_send_okay (vl))
{
#if COLLECT_DEBUG
diff --git a/src/plugin.c b/src/plugin.c
index 73ec77aba93fa0348e99f75d95f9c24117054972..d42493b9106e6938f11c3efcd50a24f639acc7b1 100644 (file)
--- a/src/plugin.c
+++ b/src/plugin.c
{
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