From: Florian Forster Date: Fri, 12 Oct 2007 16:22:51 +0000 (+0200) Subject: rrdtool plugin: Wait for the `queue thread' to exit.. X-Git-Tag: collectd-4.1.3~5 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=5e73df5f8ec52055e5f79be5d898e5baec4c9967;p=collectd.git rrdtool plugin: Wait for the `queue thread' to exit.. ..before returning from the shutdown function. --- diff --git a/src/rrdtool.c b/src/rrdtool.c index 06d97639..7002dcfb 100644 --- a/src/rrdtool.c +++ b/src/rrdtool.c @@ -1052,6 +1052,14 @@ static int rrd_shutdown (void) rrd_cache_flush (-1); pthread_mutex_unlock (&cache_lock); + /* Wait for all the values to be written to disk before returning. */ + if (queue_thread != 0) + { + pthread_join (queue_thread, NULL); + queue_thread = 0; + DEBUG ("rrdtool plugin: queue_thread exited."); + } + pthread_mutex_lock (&queue_lock); do_shutdown = 1; pthread_cond_signal (&queue_cond);