Fix: don't sleep(1) on the consumer ready flag
[lttng-tools.git] / src / bin / lttng-consumerd / lttng-consumerd.c
index 4a9a7a4929200bfd53c838eed13b48f52dd0ae50..e226ebc69e973eb34faa74d7a1be56ab7c3ab090 100644 (file)
@@ -341,7 +341,10 @@ int main(int argc, char **argv)
        }
 
        /* Init */
-       lttng_consumer_init();
+       if (lttng_consumer_init() < 0) {
+               goto error;
+       }
+
        /* Init socket timeouts */
        lttcomm_init();
        lttcomm_inet_init();
@@ -405,9 +408,6 @@ int main(int argc, char **argv)
 
        ctx->type = opt_type;
 
-       /* Initialize communication library */
-       lttcomm_init();
-
        ret = utils_create_pipe(health_quit_pipe);
        if (ret < 0) {
                goto error_health_pipe;
@@ -426,7 +426,7 @@ int main(int argc, char **argv)
         * sessiond thread reply to the sessiond that we are ready.
         */
        while (uatomic_read(&lttng_consumer_ready)) {
-               sleep(1);
+               usleep(100000);
        }
        cmm_smp_mb();   /* Read ready before following operations */
 
This page took 0.024388 seconds and 5 git commands to generate.