X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fmanage-consumer.cpp;h=d9d1e670ec87e2da1f356c4dc2930db6005a1c83;hb=8a00688e1d58cc5a2e77eba206ff23bd6105130c;hp=a3bb816f9459457ab0a1a74379bab796283a228b;hpb=6b979fc6dd8c03ed8332bdef2915b9d6d3ecfd6a;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/manage-consumer.cpp b/src/bin/lttng-sessiond/manage-consumer.cpp index a3bb816f9..d9d1e670e 100644 --- a/src/bin/lttng-sessiond/manage-consumer.cpp +++ b/src/bin/lttng-sessiond/manage-consumer.cpp @@ -55,13 +55,13 @@ static void wait_until_thread_is_ready(struct thread_notifiers *notifiers) */ static void *thread_consumer_management(void *data) { - int sock = -1, i, ret, pollfd, err = -1, should_quit = 0; - uint32_t revents, nb_fd; + int sock = -1, i, ret, err = -1, should_quit = 0; + uint32_t nb_fd; enum lttcomm_return_code code; struct lttng_poll_event events; struct thread_notifiers *notifiers = (thread_notifiers *) data; struct consumer_data *consumer_data = notifiers->consumer_data; - const int quit_pipe_read_fd = lttng_pipe_get_readfd(notifiers->quit_pipe); + const auto thread_quit_pipe_fd = lttng_pipe_get_readfd(notifiers->quit_pipe); struct consumer_socket *cmd_socket_wrapper = NULL; DBG("[thread] Manage consumer started"); @@ -83,7 +83,7 @@ static void *thread_consumer_management(void *data) goto error_poll; } - ret = lttng_poll_add(&events, quit_pipe_read_fd, LPOLLIN | LPOLLERR); + ret = lttng_poll_add(&events, thread_quit_pipe_fd, LPOLLIN | LPOLLERR); if (ret < 0) { mark_thread_intialization_as_failed(notifiers); goto error; @@ -121,13 +121,14 @@ static void *thread_consumer_management(void *data) for (i = 0; i < nb_fd; i++) { /* Fetch once the poll data */ - revents = LTTNG_POLL_GETEV(&events, i); - pollfd = LTTNG_POLL_GETFD(&events, i); + const auto revents = LTTNG_POLL_GETEV(&events, i); + const auto pollfd = LTTNG_POLL_GETFD(&events, i); health_code_update(); - /* Thread quit pipe has been closed. Killing thread. */ - if (pollfd == quit_pipe_read_fd) { + /* Activity on thread quit pipe, exiting. */ + if (pollfd == thread_quit_pipe_fd) { + DBG("Activity on thread quit pipe"); err = 0; mark_thread_intialization_as_failed(notifiers); goto exit; @@ -290,8 +291,8 @@ static void *thread_consumer_management(void *data) for (i = 0; i < nb_fd; i++) { /* Fetch once the poll data */ - revents = LTTNG_POLL_GETEV(&events, i); - pollfd = LTTNG_POLL_GETFD(&events, i); + const auto revents = LTTNG_POLL_GETEV(&events, i); + const auto pollfd = LTTNG_POLL_GETFD(&events, i); health_code_update(); @@ -300,7 +301,7 @@ static void *thread_consumer_management(void *data) * but continue the current loop to handle potential data from * consumer. */ - if (pollfd == quit_pipe_read_fd) { + if (pollfd == thread_quit_pipe_fd) { should_quit = 1; } else if (pollfd == sock) { /* Event on the consumerd socket */