]> err.no Git - varnish/commitdiff
Now that varnishd's -d -d mode behaves correctly, use a more
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 17 Jun 2008 10:15:20 +0000 (10:15 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 17 Jun 2008 10:15:20 +0000 (10:15 +0000)
civilized shutdown sequence.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2726 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishtest/vtc_varnish.c

index 84b9b0dd9696947bce66a3830abf4cfefa1936db..88704fc123b267741cd45b0d77b8d71e49baf43d 100644 (file)
@@ -38,6 +38,7 @@
 #include <signal.h>
 
 #include <sys/types.h>
+#include <sys/wait.h>
 #include <sys/socket.h>
 
 
@@ -267,18 +268,21 @@ static void
 varnish_wait(struct varnish *v)
 {
        void *p;
+       int status, r;
 
        if (v->cli_fd < 0)
                return;
        varnish_stop(v);
        printf("##   %-4s Wait\n", v->name);
-       AZ(kill(v->pid, SIGKILL));
-       AZ(pthread_cancel(v->tp));
-       AZ(pthread_join(v->tp, &p));
-       close(v->fds[0]);
-       close(v->fds[1]);
-       close(v->cli_fd);
+       AZ(close(v->cli_fd));
        v->cli_fd = -1;
+
+       AZ(close(v->fds[1]));
+
+       AZ(pthread_join(v->tp, &p));
+       AZ(close(v->fds[0]));
+       r = wait4(v->pid, &status, 0, NULL);
+       printf("##   %-4s R %d Status: %04x\n", v->name, r, status);
 }
 
 /**********************************************************************