Add lttng_waiter utils
[lttng-tools.git] / src / bin / lttng-sessiond / main.c
index b856e126fa3fae8c6cc2c3e3d69ae63dd43a84fc..9b6f70cd08134acfa45afa1d970735d3d2ee6a4c 100644 (file)
@@ -600,8 +600,7 @@ static void wait_consumer(struct consumer_data *consumer_data)
        ret = waitpid(consumer_data->pid, &status, 0);
        if (ret == -1) {
                PERROR("consumerd waitpid pid: %d", consumer_data->pid)
-       }
-       if (!WIFEXITED(status)) {
+       } else  if (!WIFEXITED(status)) {
                ERR("consumerd termination with error: %d",
                                WEXITSTATUS(ret));
        }
@@ -5619,6 +5618,7 @@ int main(int argc, char **argv)
        struct lttng_pipe *ust32_channel_monitor_pipe = NULL,
                        *ust64_channel_monitor_pipe = NULL,
                        *kernel_channel_monitor_pipe = NULL;
+       bool notification_thread_running = false;
 
        init_kernel_workarounds();
 
@@ -6130,6 +6130,7 @@ int main(int argc, char **argv)
                stop_threads();
                goto exit_notification;
        }
+       notification_thread_running = true;
 
        /* Create thread to manage the client socket */
        ret = pthread_create(&client_thread, default_pthread_attr(),
@@ -6333,17 +6334,19 @@ exit_init_data:
         * of the active session and channels at the moment of the teardown.
         */
        if (notification_thread_handle) {
-               notification_thread_command_quit(notification_thread_handle);
+               if (notification_thread_running) {
+                       notification_thread_command_quit(
+                                       notification_thread_handle);
+                       ret = pthread_join(notification_thread, &status);
+                       if (ret) {
+                               errno = ret;
+                               PERROR("pthread_join notification thread");
+                               retval = -1;
+                       }
+               }
                notification_thread_handle_destroy(notification_thread_handle);
        }
 
-       ret = pthread_join(notification_thread, &status);
-       if (ret) {
-               errno = ret;
-               PERROR("pthread_join notification thread");
-               retval = -1;
-       }
-
        rcu_thread_offline();
        rcu_unregister_thread();
 
This page took 0.023427 seconds and 4 git commands to generate.