[lttng-dev] [PATCH lttng-tools 6/6] Fix: exit threads not only on goto restart
Mathieu Desnoyers
mathieu.desnoyers at efficios.com
Mon Jan 5 16:43:08 EST 2015
Exit threads as soon as number of FD is 0, on every loop (no need for
goto restart special case). Number of FD being 0 is a sufficient
condition for exiting the thread: it means the quit pipe has been
removed from the poll set.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
src/common/consumer.c | 24 +++++++-----------------
1 file changed, 7 insertions(+), 17 deletions(-)
diff --git a/src/common/consumer.c b/src/common/consumer.c
index ef5da12..607116f 100644
--- a/src/common/consumer.c
+++ b/src/common/consumer.c
@@ -2181,14 +2181,6 @@ void *consumer_thread_metadata_poll(void *data)
DBG("Metadata main loop started");
while (1) {
- health_code_update();
-
- /* Only the metadata pipe is set */
- if (LTTNG_POLL_GETNB(&events) == 0 && consumer_quit == 1) {
- err = 0; /* All is OK */
- goto end;
- }
-
restart:
health_code_update();
health_poll_entry();
@@ -2203,7 +2195,10 @@ restart:
ERR("Poll EINTR catched");
goto restart;
}
- goto error;
+ if (LTTNG_POLL_GETNB(&events) == 0) {
+ err = 0; /* All is OK */
+ }
+ goto end;
}
nb_fd = ret;
@@ -2759,14 +2754,6 @@ void *consumer_thread_channel_poll(void *data)
DBG("Channel main loop started");
while (1) {
- health_code_update();
-
- /* Only the channel pipe is set */
- if (LTTNG_POLL_GETNB(&events) == 0 && consumer_quit == 1) {
- err = 0; /* All is OK */
- goto end;
- }
-
restart:
health_code_update();
DBG("Channel poll wait");
@@ -2781,6 +2768,9 @@ restart:
ERR("Poll EINTR catched");
goto restart;
}
+ if (LTTNG_POLL_GETNB(&events) == 0) {
+ err = 0; /* All is OK */
+ }
goto end;
}
--
2.1.1
More information about the lttng-dev
mailing list