kconsumerd dying when sessiond shutdown cmd socket
authorDavid Goulet <david.goulet@polymtl.ca>
Thu, 2 Jun 2011 17:20:05 +0000 (13:20 -0400)
committerDavid Goulet <david.goulet@polymtl.ca>
Thu, 2 Jun 2011 17:20:48 +0000 (13:20 -0400)
Signed-off-by: David Goulet <david.goulet@polymtl.ca>
kconsumerd/kconsumerd.c

index fd0b0b80cd6b19747fe6dcf7378504423e4dd3af..d14f68b4c2d87e5f2c166efed49ac41667f68ba8 100644 (file)
@@ -540,7 +540,6 @@ static void *thread_receive_fds(void *data)
                }
                if (tmp.cmd_type == STOP) {
                        DBG("Received STOP command");
-                       quit = 1;
                        goto end;
                }
                /* we received a command to add or update fds */
@@ -553,6 +552,11 @@ static void *thread_receive_fds(void *data)
 
 end:
        DBG("thread_receive_fds exiting");
+       quit = 1;
+       ret = write(poll_pipe[1], "4", 1);
+       if (ret < 0) {
+               perror("poll pipe write");
+       }
        return NULL;
 }
 
@@ -671,6 +675,11 @@ static void *thread_poll_fds(void *data)
                        goto end;
                }
 
+               /* No FDs and quit, cleanup the thread */
+               if (nb_fd == 0 && quit == 1) {
+                       goto end;
+               }
+
                /*
                 * if only the poll_pipe triggered poll to return just return to the
                 * beginning of the loop to update the array
This page took 0.025273 seconds and 4 git commands to generate.