Fix incorrect thread cleanup on blocking recv()
authorDavid Goulet <david.goulet@polymtl.ca>
Wed, 17 Aug 2011 20:23:35 +0000 (16:23 -0400)
committerDavid Goulet <david.goulet@polymtl.ca>
Wed, 17 Aug 2011 20:23:35 +0000 (16:23 -0400)
Signed-off-by: David Goulet <david.goulet@polymtl.ca>
ltt-sessiond/main.c

index 153b215c08c0277f31930afbe86ad95193689665..abd4e087fd313c11fea10376393b32e9f6c29e5c 100644 (file)
@@ -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) {
This page took 0.026546 seconds and 4 git commands to generate.