X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrdtool.c;h=d274ba021b65146cd2cf7195421e045c52a1f5d5;hb=b400d28e853eea66d6f233a3524009dea01d9e41;hp=368858172a92dfee9fb52d56eebb3e86e5c2ab57;hpb=febe816d5cf4dff6c35936fd3c5ced8e49ca6ee8;p=collectd.git diff --git a/src/rrdtool.c b/src/rrdtool.c index 36885817..d274ba02 100644 --- a/src/rrdtool.c +++ b/src/rrdtool.c @@ -1053,6 +1053,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) { @@ -1061,11 +1066,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 */