[master] 99770c310 varnishtest: added flag indicating if varnish output logger is running

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Wed Jul 3 09:33:05 UTC 2024


commit 99770c310d12270e0f554c0648cf220a21f79704
Author: Stephane Cance <stephane.cance at varnish-software.com>
Date:   Thu May 2 13:20:24 2024 +0200

    varnishtest: added flag indicating if varnish output logger is running

diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index 6f8223859..0564ec61a 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -71,6 +71,7 @@ struct varnish {
 
 	pthread_t		tp;
 	pthread_t		tp_vsl;
+	int			tp_started;
 
 	int			expect_exit;
 
@@ -473,6 +474,8 @@ varnish_launch(struct varnish *v)
 	v->fds[0] = v->fds[2];
 	v->fds[2] = v->fds[3] = -1;
 	VSB_destroy(&vsb);
+	AZ(v->tp_started);
+	v->tp_started = 1;
 	PTOK(pthread_create(&v->tp, NULL, varnish_thread, v));
 
 	/* Wait for the varnish to call home */
@@ -682,8 +685,10 @@ varnish_cleanup(struct varnish *v)
 	closefd(&v->fds[1]);
 
 	/* Wait until STDOUT+STDERR closes */
+	AN(v->tp_started);
 	PTOK(pthread_join(v->tp, &p));
 	closefd(&v->fds[0]);
+	v->tp_started = 0;
 
 	/* Pick up the VSL thread */
 	PTOK(pthread_join(v->tp_vsl, &p));


More information about the varnish-commit mailing list