Use plugin_thread_create() rather than pthread_create() in all plugins.
[collectd.git] / src / amqp.c
index f0abd44..db65791 100644 (file)
@@ -543,6 +543,8 @@ static void *camqp_subscribe_thread (void *user_data) /* {{{ */
     camqp_config_t *conf = user_data;
     int status;
 
+    cdtime_t interval = plugin_get_interval ();
+
     while (subscriber_threads_running)
     {
         amqp_frame_t frame;
@@ -551,8 +553,9 @@ static void *camqp_subscribe_thread (void *user_data) /* {{{ */
         if (status != 0)
         {
             ERROR ("amqp plugin: camqp_connect failed. "
-                    "Will sleep for %i seconds.", interval_g);
-            sleep (interval_g);
+                    "Will sleep for %.3f seconds.",
+                    CDTIME_T_TO_DOUBLE (interval));
+            sleep (interval);
             continue;
         }
 
@@ -560,9 +563,10 @@ static void *camqp_subscribe_thread (void *user_data) /* {{{ */
         if (status < 0)
         {
             ERROR ("amqp plugin: amqp_simple_wait_frame failed. "
-                    "Will sleep for %i seconds.", interval_g);
+                    "Will sleep for %.3f seconds.",
+                    CDTIME_T_TO_DOUBLE (interval));
             camqp_close_connection (conf);
-            sleep (interval_g);
+            sleep (interval);
             continue;
         }
 
@@ -606,7 +610,7 @@ static int camqp_subscribe_init (camqp_config_t *conf) /* {{{ */
     tmp = subscriber_threads + subscriber_threads_num;
     memset (tmp, 0, sizeof (*tmp));
 
-    status = pthread_create (tmp, /* attr = */ NULL,
+    status = plugin_thread_create (tmp, /* attr = */ NULL,
             camqp_subscribe_thread, conf);
     if (status != 0)
     {