+ /*
+ * Block RT signals used for UST periodical metadata flush and the live
+ * timer in main, and create a dedicated thread to handle these signals.
+ */
+ if (consumer_signal_init()) {
+ retval = -1;
+ goto exit_init_data;
+ }
+
+ ctx->type = opt_type;
+
+ if (utils_create_pipe(health_quit_pipe)) {
+ retval = -1;
+ goto exit_health_pipe;
+ }
+
+ /* Create thread to manage the client socket */
+ ret = pthread_create(&health_thread, NULL,
+ thread_manage_health, (void *) NULL);
+ if (ret) {
+ errno = ret;
+ PERROR("pthread_create health");
+ retval = -1;
+ goto exit_health_thread;
+ }
+
+ /*
+ * Wait for health thread to be initialized before letting the
+ * sessiond thread reply to the sessiond that we are ready.
+ */
+ while (uatomic_read(<tng_consumer_ready)) {
+ usleep(100000);
+ }
+ cmm_smp_mb(); /* Read ready before following operations */
+
+ /* Create thread to manage channels */
+ ret = pthread_create(&channel_thread, NULL,
+ consumer_thread_channel_poll,
+ (void *) ctx);
+ if (ret) {
+ errno = ret;
+ PERROR("pthread_create");
+ retval = -1;
+ goto exit_channel_thread;
+ }
+