From: Florian Forster Date: Fri, 12 Oct 2007 20:59:15 +0000 (+0200) Subject: rrdtool plugin: Wait for the ``queue thread'' to exit _after_ signaling it to exit.. X-Git-Tag: collectd-4.2.0~24 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=00bcab03d1eef375a648698287adfbae757ccb73;p=collectd.git rrdtool plugin: Wait for the ``queue thread'' to exit _after_ signaling it to exit.. --- diff --git a/src/rrdtool.c b/src/rrdtool.c index 9fc68728..ab031376 100644 --- a/src/rrdtool.c +++ b/src/rrdtool.c @@ -1051,6 +1051,11 @@ static int rrd_shutdown (void) rrd_cache_flush (-1); pthread_mutex_unlock (&cache_lock); + pthread_mutex_lock (&queue_lock); + do_shutdown = 1; + pthread_cond_signal (&queue_cond); + pthread_mutex_unlock (&queue_lock); + /* Wait for all the values to be written to disk before returning. */ if (queue_thread != 0) { @@ -1059,11 +1064,6 @@ static int rrd_shutdown (void) DEBUG ("rrdtool plugin: queue_thread exited."); } - pthread_mutex_lock (&queue_lock); - do_shutdown = 1; - pthread_cond_signal (&queue_cond); - pthread_mutex_unlock (&queue_lock); - return (0); } /* int rrd_shutdown */