[master] e1da1915e Attempt to use `pthread_condattr_setclock(&ca, CLOCK_MONOTONIC)`
Dridi Boukelmoune
dridi at varni.sh
Mon Oct 11 21:50:52 UTC 2021
On Mon, Oct 11, 2021 at 9:41 PM Poul-Henning Kamp <phk at freebsd.org> wrote:
>
>
> commit e1da1915e8966ad38dd327b8728fd3f00557b83a
> Author: Poul-Henning Kamp <phk at FreeBSD.org>
> Date: Mon Oct 11 21:40:22 2021 +0000
>
> Attempt to use `pthread_condattr_setclock(&ca, CLOCK_MONOTONIC)`
>
> diff --git a/bin/varnishhist/varnishhist.c b/bin/varnishhist/varnishhist.c
> index 539245305..365ac2a84 100644
> --- a/bin/varnishhist/varnishhist.c
> +++ b/bin/varnishhist/varnishhist.c
> @@ -366,9 +366,8 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[],
> vsl_to = vsl_t0 + (t - t0) * timebend;
>
> if (vsl_ts > vsl_to) {
> - double when = VTIM_real() + vsl_ts - vsl_to;
> struct timespec ts;
> - ts.tv_nsec = (long)(modf(when, &t) * 1e9);
> + ts.tv_nsec = (long)(modf(vsl_ts - vsl_to, &t) * 1e9);
> ts.tv_sec = (long)t;
> i = pthread_cond_timedwait(&timebend_cv, &mtx, &ts);
> assert(i == 0 || i == ETIMEDOUT);
> @@ -487,9 +486,12 @@ 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, NULL));
Did you forget to pass ca to pthread_cond_init() ?
More information about the varnish-commit
mailing list