[master] 476589b Stall until waiter is drained.

Poul-Henning Kamp phk at FreeBSD.org
Thu May 21 22:33:07 CEST 2015


commit 476589bde8f27a11baaa44235aee12799aeca2a2
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu May 21 20:23:56 2015 +0000

    Stall until waiter is drained.

diff --git a/bin/varnishd/waiter/cache_waiter_poll.c b/bin/varnishd/waiter/cache_waiter_poll.c
index bb87b17..718a023 100644
--- a/bin/varnishd/waiter/cache_waiter_poll.c
+++ b/bin/varnishd/waiter/cache_waiter_poll.c
@@ -234,7 +234,10 @@ vwp_init(struct waiter *w)
 	AZ(pthread_create(&vwp->thread, NULL, vwp_main, vwp));
 }
 
-/*--------------------------------------------------------------------*/
+/*--------------------------------------------------------------------
+ * It is the callers responsibility to trigger all fd's waited on to
+ * fail somehow.
+ */
 
 static void __match_proto__(waiter_fini_f)
 vwp_fini(struct waiter *w)
@@ -244,6 +247,8 @@ vwp_fini(struct waiter *w)
 
 	CAST_OBJ_NOTNULL(vwp, w->priv, VWP_MAGIC);
 	vp = NULL;
+	while (vwp->hpoll > 1)
+		usleep(100000);
 	// XXX: set write pipe blocking
 	assert(write(vwp->pipes[1], &vp, sizeof vp) == sizeof vp);
 	AZ(pthread_join(vwp->thread, &vp));



More information about the varnish-commit mailing list