r3979 - in trunk/varnish-cache/bin: varnishd varnishtest
phk at projects.linpro.no
phk at projects.linpro.no
Sun Mar 22 17:35:25 CET 2009
Author: phk
Date: 2009-03-22 17:35:25 +0100 (Sun, 22 Mar 2009)
New Revision: 3979
Modified:
trunk/varnish-cache/bin/varnishd/cache_pool.c
trunk/varnish-cache/bin/varnishtest/vtc.c
Log:
Use TIM_sleep() instead of usleep() where duration might be longer than
the one second Open Group allows.
Fixes #475
Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pool.c 2009-03-22 16:23:23 UTC (rev 3978)
+++ trunk/varnish-cache/bin/varnishd/cache_pool.c 2009-03-22 16:35:25 UTC (rev 3979)
@@ -545,7 +545,7 @@
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 @@
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 @@
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;
Modified: trunk/varnish-cache/bin/varnishtest/vtc.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc.c 2009-03-22 16:23:23 UTC (rev 3978)
+++ trunk/varnish-cache/bin/varnishtest/vtc.c 2009-03-22 16:35:25 UTC (rev 3979)
@@ -263,11 +263,7 @@
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);
}
/**********************************************************************
More information about the varnish-commit
mailing list