src/Makefile: Don't unnecessarily set plugin specific CXXFLAGS.
[collectd.git] / src / statsd.c
index 5b7a6f1..3c08861 100644 (file)
@@ -955,8 +955,6 @@ static int statsd_shutdown (void) /* {{{ */
   void *key;
   void *value;
 
-  pthread_mutex_lock (&metrics_lock);
-
   if (network_thread_running)
   {
     network_thread_shutdown = 1;
@@ -965,6 +963,8 @@ static int statsd_shutdown (void) /* {{{ */
   }
   network_thread_running = 0;
 
+  pthread_mutex_lock (&metrics_lock);
+
   while (c_avl_pick (metrics_tree, &key, &value) == 0)
   {
     sfree (key);