X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fnotification-thread.c;h=70ab7bb5fceb974c0acd04a8003ae453ea5a2efe;hp=58c3f2bff7baa5b1c490dabd716d5729001c8cb6;hb=d72c8834befc320e91576140ed0abace2eabbf7a;hpb=ab0ee2ca29394fa28284b94cc3c598960660404f diff --git a/src/bin/lttng-sessiond/notification-thread.c b/src/bin/lttng-sessiond/notification-thread.c index 58c3f2bff..70ab7bb5f 100644 --- a/src/bin/lttng-sessiond/notification-thread.c +++ b/src/bin/lttng-sessiond/notification-thread.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -158,7 +157,6 @@ void notification_thread_handle_destroy( struct notification_thread_handle *handle) { int ret; - struct notification_thread_command *cmd, *tmp; if (!handle) { goto end; @@ -172,15 +170,7 @@ void notification_thread_handle_destroy( PERROR("close notification command queue event_fd"); } - pthread_mutex_lock(&handle->cmd_queue.lock); - /* Purge queue of in-flight commands and mark them as cancelled. */ - cds_list_for_each_entry_safe(cmd, tmp, &handle->cmd_queue.list, - cmd_list_node) { - cds_list_del(&cmd->cmd_list_node); - cmd->reply_code = LTTNG_ERR_COMMAND_CANCELLED; - futex_nto1_wake(&cmd->reply_futex); - } - pthread_mutex_unlock(&handle->cmd_queue.lock); + assert(cds_list_empty(&handle->cmd_queue.list)); pthread_mutex_destroy(&handle->cmd_queue.lock); if (handle->channel_monitoring_pipes.ust32_consumer >= 0) { @@ -219,7 +209,7 @@ struct notification_thread_handle *notification_thread_handle_create( } /* FIXME Replace eventfd by a pipe to support older kernels. */ - handle->cmd_queue.event_fd = eventfd(0, EFD_CLOEXEC); + handle->cmd_queue.event_fd = eventfd(0, EFD_CLOEXEC | EFD_SEMAPHORE); if (handle->cmd_queue.event_fd < 0) { PERROR("eventfd notification command queue"); goto error; @@ -642,6 +632,9 @@ void *thread_notification(void *data) int fd = LTTNG_POLL_GETFD(&state.events, i); uint32_t revents = LTTNG_POLL_GETEV(&state.events, i); + if (!revents) { + continue; + } DBG("[notification-thread] Handling fd (%i) activity (%u)", fd, revents); if (fd == state.notification_channel_socket) {