From 72079caee725ad8d3ec0dc52fe7f982d61721b84 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Wed, 17 Aug 2011 16:23:35 -0400 Subject: [PATCH 1/1] Fix incorrect thread cleanup on blocking recv() Signed-off-by: David Goulet --- ltt-sessiond/main.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ltt-sessiond/main.c b/ltt-sessiond/main.c index 153b215c0..abd4e087f 100644 --- a/ltt-sessiond/main.c +++ b/ltt-sessiond/main.c @@ -753,6 +753,25 @@ static void *thread_manage_kconsumerd(void *data) goto error; } + /* Kconsumerd err socket */ + pollfd[1].fd = sock; + pollfd[1].events = POLLIN; + + /* Inifinite blocking call, waiting for transmission */ + ret = poll(pollfd, 2, -1); + if (ret < 0) { + perror("poll kconsumerd thread"); + goto error; + } + + /* Thread quit pipe has been closed. Killing thread. */ + if (pollfd[0].revents == POLLNVAL) { + goto error; + } else if (pollfd[1].revents == POLLERR) { + ERR("Kconsumerd err socket second poll error"); + goto error; + } + /* Wait for any kconsumerd error */ ret = lttcomm_recv_unix_sock(sock, &code, sizeof(enum lttcomm_return_code)); if (ret <= 0) { -- 2.34.1