From: David Goulet Date: Wed, 17 Aug 2011 20:23:35 +0000 (-0400) Subject: Fix incorrect thread cleanup on blocking recv() X-Git-Tag: v2.0-pre12~10 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=72079caee725ad8d3ec0dc52fe7f982d61721b84;p=lttng-tools.git Fix incorrect thread cleanup on blocking recv() Signed-off-by: David Goulet --- 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) {