[master] 7d5da1680 Dont use pthread_condattr_setclock(2) anyway, OSX does not have it.

Poul-Henning Kamp phk at FreeBSD.org
Tue Oct 26 20:14:10 UTC 2021


commit 7d5da1680b7d2cbcf5da4331f65eb42377e48bec
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Oct 26 18:07:50 2021 +0000

    Dont use pthread_condattr_setclock(2) anyway, OSX does not have it.

diff --git a/bin/varnishhist/varnishhist.c b/bin/varnishhist/varnishhist.c
index 27d4f9289..9a4d58917 100644
--- a/bin/varnishhist/varnishhist.c
+++ b/bin/varnishhist/varnishhist.c
@@ -366,8 +366,8 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[],
 	vsl_to = vsl_t0 + (t - t0) * timebend;
 
 	if (vsl_ts > vsl_to) {
-		struct timespec ts;
-		ts = VTIM_timespec(vsl_ts - vsl_to);
+		double when = VTIM_real() + vsl_ts - vsl_to;
+		struct timespec ts = VTIM_timespec(when);
 		i = pthread_cond_timedwait(&timebend_cv, &mtx, &ts);
 		assert(i == 0 || i == ETIMEDOUT);
 	}
@@ -485,13 +485,10 @@ main(int argc, char **argv)
 	pthread_t thr;
 	int fnum;
 	struct profile cli_p = {0};
-	pthread_condattr_t ca;
 
 	vut = VUT_InitProg(argc, argv, &vopt_spec);
 	AN(vut);
-	AZ(pthread_condattr_init(&ca));
-	AZ(pthread_condattr_setclock(&ca, CLOCK_MONOTONIC));
-	AZ(pthread_cond_init(&timebend_cv, &ca));
+	AZ(pthread_cond_init(&timebend_cv, NULL));
 
 	while ((i = getopt(argc, argv, vopt_spec.vopt_optstring)) != -1) {
 		switch (i) {


More information about the varnish-commit mailing list