r4509 - trunk/varnish-cache/bin/varnishtest

phk at projects.linpro.no phk at projects.linpro.no
Thu Jan 28 12:51:09 CET 2010


Author: phk
Date: 2010-01-28 12:51:09 +0100 (Thu, 28 Jan 2010)
New Revision: 4509

Modified:
   trunk/varnish-cache/bin/varnishtest/vtc.c
Log:
Be even more paranoid about the condvar used for the timeout.



Modified: trunk/varnish-cache/bin/varnishtest/vtc.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc.c	2010-01-28 11:21:25 UTC (rev 4508)
+++ trunk/varnish-cache/bin/varnishtest/vtc.c	2010-01-28 11:51:09 UTC (rev 4509)
@@ -482,7 +482,9 @@
 	vtc_log(vltop, 1, "RESETTING after %s", pe->fn);
 	reset_cmds(cmds);
 	vtc_error = old_err;
+	AZ(pthread_mutex_lock(&vtc_mtx));
 	AZ(pthread_cond_signal(&vtc_cond));
+	AZ(pthread_mutex_unlock(&vtc_mtx));
 	return (NULL);
 }
 
@@ -507,12 +509,14 @@
 		    fn, strerror(errno));
 	pe.fn = fn;
 
-	AZ(pthread_create(&pt, NULL, exec_file_thread, &pe));
-	AZ(pthread_mutex_lock(&vtc_mtx));
 	AZ(clock_gettime(CLOCK_REALTIME, &ts));
 	ts.tv_sec += dur;
+
+	AZ(pthread_mutex_lock(&vtc_mtx));
+	AZ(pthread_create(&pt, NULL, exec_file_thread, &pe));
 	i = pthread_cond_timedwait(&vtc_cond, &vtc_mtx, &ts);
 	AZ(pthread_mutex_unlock(&vtc_mtx));
+
 	if (i == ETIMEDOUT)  {
 		vtc_log(vltop, 1, "Test timed out");
 		vtc_error = 1;



More information about the varnish-commit mailing list