Commit e962baef authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Use TIM_sleep() instead of usleep() where duration might be longer than

the one second Open Group allows.

Fixes #475



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@3979 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 4ef83d4e
......@@ -545,7 +545,7 @@ wrk_decimate_flock(struct wq *qp, double t_idle, struct varnish_stats *vs)
if (w != NULL) {
AZ(w->wrq);
AZ(pthread_cond_signal(&w->cond));
(void)usleep(params->wthread_purge_delay * 1000);
TIM_sleep(params->wthread_purge_delay * 1e-3);
}
}
......@@ -601,7 +601,7 @@ wrk_herdtimer_thread(void *priv)
VSL_stats->n_wrk_drop = vs->n_wrk_drop;
VSL_stats->n_wrk_overflow = vs->n_wrk_overflow;
(void)usleep(params->wthread_purge_delay * 1000);
TIM_sleep(params->wthread_purge_delay * 1e-3);
}
}
......@@ -627,11 +627,11 @@ wrk_breed_flock(struct wq *qp)
VSL(SLT_Debug, 0, "Create worker thread failed %d %s",
errno, strerror(errno));
VSL_stats->n_wrk_failed++;
(void)usleep(params->wthread_fail_delay * 1000);
TIM_sleep(params->wthread_fail_delay * 1e-3);
} else {
AZ(pthread_detach(tp));
VSL_stats->n_wrk_create++;
(void)usleep(params->wthread_add_delay * 1000);
TIM_sleep(params->wthread_add_delay * 1e-3);
}
}
qp->lqueue = qp->nqueue;
......
......@@ -263,11 +263,7 @@ cmd_delay(CMD_ARGS)
AZ(av[2]);
f = strtod(av[1], NULL);
vtc_log(vl, 3, "delaying %g second(s)", f);
if (f > 100.) {
(void)sleep((int)f);
} else {
(void)usleep((int)(f * 1e6));
}
TIM_sleep(f);
}
/**********************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment